Patchwork D776: merge: add merge action 'p' to record path conflicts during update

login
register
mail settings
Submitter phabricator
Date Oct. 10, 2017, 1:26 a.m.
Message ID <328356c3aa7d316621603a3f23cd3080@localhost.localdomain>
Download mbox | patch
Permalink /patch/24686/
State Not Applicable
Headers show

Comments

phabricator - Oct. 10, 2017, 1:26 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG337512875503: merge: add merge action &#039;p&#039; to record path conflicts during update (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D776?vs=2353&id=2547

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

AFFECTED FILES
  mercurial/merge.py
  mercurial/sparse.py

CHANGE DETAILS




To: mbthomas, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel

Patch

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -486,7 +486,8 @@ 
                 dropped.append(file)
 
     # Apply changes to disk
-    typeactions = dict((m, []) for m in 'a f g am cd dc r dm dg m e k'.split())
+    typeactions = dict((m, [])
+                       for m in 'a f g am cd dc r dm dg m e k p'.split())
     for f, (m, args, msg) in actions.iteritems():
         if m not in typeactions:
             typeactions[m] = []
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1243,12 +1243,27 @@ 
             wctx[f].remove()
 
     numupdates = sum(len(l) for m, l in actions.items() if m != 'k')
+    z = 0
 
     if [a for a in actions['r'] if a[0] == '.hgsubstate']:
         subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels)
 
-    # remove in parallel (must come first)
-    z = 0
+    # record path conflicts
+    for f, args, msg in actions['p']:
+        f1, fo = args
+        s = repo.ui.status
+        s(_("%s: path conflict - a file or link has the same name as a "
+            "directory\n") % f)
+        if fo == 'l':
+            s(_("the local file has been renamed to %s\n") % f1)
+        else:
+            s(_("the remote file has been renamed to %s\n") % f1)
+        s(_("resolve manually then use 'hg resolve --mark %s'\n") % f)
+        ms.addpath(f, f1, fo)
+        z += 1
+        progress(_updating, z, item=f, total=numupdates, unit=_files)
+
+    # remove in parallel (must come before getting)
     prog = worker.worker(repo.ui, 0.001, batchremove, (repo, wctx),
                          actions['r'])
     for i, item in prog:
@@ -1698,7 +1713,8 @@ 
                     del actionbyfile[f]
 
         # Convert to dictionary-of-lists format
-        actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split())
+        actions = dict((m, [])
+                       for m in 'a am f g cd dc r dm dg m e k p'.split())
         for f, (m, args, msg) in actionbyfile.iteritems():
             if m not in actions:
                 actions[m] = []