localrepo.commit: disallow commit when driver-resolved files exist
authorSiddharth Agarwal <sid0@fb.com>
Wed, 14 Oct 2015 16:04:43 -0700
changeset 26741 e1568d5eb052
parent 26740 f4a27c05c43f
child 26742 bec1a579ebc4
localrepo.commit: disallow commit when driver-resolved files exist This code will not currently be activated because there's no code to mark files as driver-resolved in core. This point is also somewhat hard to plug into from extensions.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Wed Oct 14 15:01:07 2015 -0700
+++ b/mercurial/localrepo.py	Wed Oct 14 16:04:43 2015 -0700
@@ -1553,11 +1553,21 @@
             if merge and cctx.deleted():
                 raise error.Abort(_("cannot commit merge with missing files"))
 
+            unresolved, driverresolved = False, False
             ms = mergemod.mergestate(self)
             for f in status.modified:
-                if f in ms and ms[f] == 'u':
-                    raise error.Abort(_('unresolved merge conflicts '
-                                       '(see "hg help resolve")'))
+                if f in ms:
+                    if ms[f] == 'u':
+                        unresolved = True
+                    elif ms[f] == 'd':
+                        driverresolved = True
+
+            if unresolved:
+                raise error.Abort(_('unresolved merge conflicts '
+                                    '(see "hg help resolve")'))
+            if driverresolved:
+                raise error.Abort(_('driver-resolved merge conflicts'),
+                                  hint=_('run "hg resolve --all" to resolve'))
 
             if editor:
                 cctx._text = editor(self, cctx, subs)