[PATCH v4 07/13] remote-hg: match hg merge behavior
From: Felipe Contreras <hidden>
Date: 2016-06-15 22:55:08
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Felipe Contreras <redacted> --- contrib/remote-hg/git-remote-hg | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/contrib/remote-hg/git-remote-hg b/contrib/remote-hg/git-remote-hg
index 1689573..57e54c2 100755
--- a/contrib/remote-hg/git-remote-hg
+++ b/contrib/remote-hg/git-remote-hg@@ -406,6 +406,12 @@ 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: + f = { 'ctx' : repo[p1][e] } + files[e] = f + def parse_commit(parser): global marks, blob_marks, bmarks, parsed_refs
@@ -450,6 +456,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)
@@ -472,6 +480,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