hgext/keyword.py
changeset 23622 cb9d845406e5
parent 23079 c4ce50a3d634
child 23722 5803bfeebbfe
--- a/hgext/keyword.py	Sun Dec 21 12:53:57 2014 +0000
+++ b/hgext/keyword.py	Sun Dec 21 13:02:59 2014 +0000
@@ -264,8 +264,17 @@
             if util.binary(data):
                 continue
             if expand:
+                parents = ctx.parents()
                 if lookup:
                     ctx = self.linkctx(f, mf[f])
+                elif self.restrict and len(parents) > 1:
+                    # merge commit
+                    # in case of conflict f is in modified state during
+                    # merge, even if f does not differ from f in parent
+                    for p in parents:
+                        if f in p and not p[f].cmp(ctx[f]):
+                            ctx = p[f].changectx()
+                            break
                 data, found = self.substitute(data, f, ctx, re_kw.subn)
             elif self.restrict:
                 found = re_kw.search(data)