Patchwork D2702: commands: use constants for merge things

login
register
mail settings
Submitter phabricator
Date March 24, 2018, 9:23 p.m.
Message ID <8b6229873d5c7e42c1a144328b04c43f@localhost.localdomain>
Download mbox | patch
Permalink /patch/29829/
State Not Applicable
Headers show

Comments

phabricator - March 24, 2018, 9:23 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG704932ef8913: commands: use constants for merge things (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4360,11 +4360,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:
@@ -4387,7 +4388,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
@@ -4408,7 +4410,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:
@@ -4423,20 +4425,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)