Patchwork D2702: commands: use constants for merge things

login
register
mail settings
Submitter phabricator
Date March 12, 2018, 10:29 p.m.
Message ID <07530288a0331461c8706fb4b05aca4f@localhost.localdomain>
Download mbox | patch
Permalink /patch/29413/
State Not Applicable
Headers show

Comments

phabricator - March 12, 2018, 10:29 p.m.
indygreg updated this revision to Diff 6971.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2702?vs=6663&id=6971

REVISION DETAIL
  https://phab.mercurial-scm.org/D2702

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4351,11 +4351,12 @@ 
         # as 'P'.  Resolved path conflicts show as 'R', the same as normal
         # resolved conflicts.
         mergestateinfo = {
-            'u': ('resolve.unresolved', 'U'),
-            'r': ('resolve.resolved', 'R'),
-            'pu': ('resolve.unresolved', 'P'),
-            'pr': ('resolve.resolved', 'R'),
-            'd': ('resolve.driverresolved', 'D'),
+            mergemod.MERGE_RECORD_UNRESOLVED: ('resolve.unresolved', 'U'),
+            mergemod.MERGE_RECORD_RESOLVED: ('resolve.resolved', 'R'),
+            mergemod.MERGE_RECORD_UNRESOLVED_PATH: ('resolve.unresolved', 'P'),
+            mergemod.MERGE_RECORD_RESOLVED_PATH: ('resolve.resolved', 'R'),
+            mergemod.MERGE_RECORD_DRIVER_RESOLVED: ('resolve.driverresolved',
+                                                    'D'),
         }
 
         for f in ms:
@@ -4378,7 +4379,8 @@ 
 
         wctx = repo[None]
 
-        if ms.mergedriver and ms.mdstate() == 'u':
+        if (ms.mergedriver
+            and ms.mdstate() == mergemod.MERGE_DRIVER_STATE_UNMARKED):
             proceed = mergemod.driverpreprocess(repo, ms, wctx)
             ms.commit()
             # allow mark and unmark to go through
@@ -4399,7 +4401,7 @@ 
 
             # don't let driver-resolved files be marked, and run the conclude
             # step if asked to resolve
-            if ms[f] == "d":
+            if ms[f] == mergemod.MERGE_RECORD_DRIVER_RESOLVED:
                 exact = m.exact(f)
                 if mark:
                     if exact:
@@ -4414,20 +4416,21 @@ 
                 continue
 
             # path conflicts must be resolved manually
-            if ms[f] in ("pu", "pr"):
+            if ms[f] in (mergemod.MERGE_RECORD_UNRESOLVED_PATH,
+                         mergemod.MERGE_RECORD_RESOLVED_PATH):
                 if mark:
-                    ms.mark(f, "pr")
+                    ms.mark(f, mergemod.MERGE_RECORD_RESOLVED_PATH)
                 elif unmark:
-                    ms.mark(f, "pu")
-                elif ms[f] == "pu":
+                    ms.mark(f, mergemod.MERGE_RECORD_UNRESOLVED_PATH)
+                elif ms[f] == mergemod.MERGE_RECORD_UNRESOLVED_PATH:
                     ui.warn(_('%s: path conflict must be resolved manually\n')
                             % f)
                 continue
 
             if mark:
-                ms.mark(f, "r")
+                ms.mark(f, mergemod.MERGE_RECORD_RESOLVED)
             elif unmark:
-                ms.mark(f, "u")
+                ms.mark(f, mergemod.MERGE_RECORD_UNRESOLVED)
             else:
                 # backup pre-resolve (merge uses .orig for its own purposes)
                 a = repo.wjoin(f)