git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v6 06/16] remote-hg: match hg merge behavior

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Nov 4, 2012, 02:13 UTC
Message-ID
<1351995218-19889-7-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1351995218-19889-1-git-send-email-felipe.contreras@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 503a9fc..247b7cb 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -427,6 +427,14 @@ def parse_blob(parser):
     parser.next()
     return
 
+def get_merge_files(repo, p1, p2, files):
+    for e in repo[p1].files():
+        if e not in files:
+            if e not in repo[p1].manifest():
+                continue
+            f = { 'ctx' : repo[p1][e] }
+            files[e] = f
+
 def parse_commit(parser):
     global marks, blob_marks, bmarks, parsed_refs
 
@@ -470,6 +478,8 @@ def parse_commit(parser):
         of = files[f]
         if 'deleted' in of:
             raise IOError
+        if 'ctx' in of:
+            return of['ctx']
         is_exec = of['mode'] == 'x'
         is_link = of['mode'] == 'l'
         return context.memfilectx(f, of['data'], is_link, is_exec, None)
@@ -492,6 +502,13 @@ def parse_commit(parser):
     else:
         p2 = '\0' * 20
 
+    #
+    # If files changed from any of the parents, hg wants to know, but in git if
+    # nothing changed from the first parent, nothing changed.
+    #
+    if merge_mark:
+        get_merge_files(repo, p1, p2, files)
+
     ctx = context.memctx(repo, (p1, p2), data,
             files.keys(), getfilectx,
             user, (date, tz), extra)
-- 
1.8.0
Previous: Felipe ContrerasNext: Felipe Contreras
Message 7 of 22 in “New remote-hg helper:w”
  1. 00/16 New remote-hg helper:wFelipe Contreras, Nov 4, 2012
  2. 01/16 Add new remote-hg transport helperFelipe Contreras, Nov 4, 2012
  3. 02/16 remote-hg: add support for pushingFelipe Contreras, Nov 4, 2012
  4. 03/16 remote-hg: add support for remote pushingFelipe Contreras, Nov 4, 2012
  5. 04/16 remote-hg: add support to push URLsFelipe Contreras, Nov 4, 2012
  6. 05/16 remote-hg: make sure the encoding is correctFelipe Contreras, Nov 4, 2012
  7. 06/16 remote-hg: match hg merge behaviorFelipe Contreras, Nov 4, 2012
  8. 07/16 remote-hg: add support for hg-git compat modeFelipe Contreras, Nov 4, 2012
  9. W. Trevor KingNov 28, 2012
  10. remote-hg: Fix biridectionality -> bidirectionality typosW. Trevor King, Jan 8, 2013
  11. Junio C HamanoJan 8, 2013
  12. W. Trevor KingJan 8, 2013
  13. Junio C HamanoJan 8, 2013
  14. 08/16 remote-hg: add compat for hg-git author fixesFelipe Contreras, Nov 4, 2012
  15. 09/16 remote-hg: fake bookmark when there's noneFelipe Contreras, Nov 4, 2012
  16. 10/16 remote-hg: add basic testsFelipe Contreras, Nov 4, 2012
  17. 11/16 test-lib: avoid full path to store test resultsFelipe Contreras, Nov 4, 2012
  18. 12/16 remote-hg: add bidirectional testsFelipe Contreras, Nov 4, 2012
  19. 13/16 remote-hg: add tests to compare with hg-gitFelipe Contreras, Nov 4, 2012
  20. 14/16 remote-hg: add extra author testFelipe Contreras, Nov 4, 2012
  21. 15/16 remote-hg: add option to not track branchesFelipe Contreras, Nov 4, 2012
  22. 16/16 remote-hg: the author email can be nullFelipe Contreras, Nov 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.