[PATCH 5 of 7 checkunknown] merge: add a new 'backup' argument to get actions

Siddharth Agarwal sid0 at fb.com
Sat Jan 2 05:25:09 CST 2016


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1451732577 28800
#      Sat Jan 02 03:02:57 2016 -0800
# Node ID c1ad84b3d9c0cc4c80e8df426dc9d8bf4c4fc488
# Parent  34ef5002224a71e6a48c2c5e7f1bb180ec1a8e12
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r c1ad84b3d9c0
merge: add a new 'backup' argument to get actions

We're going to use this in an upcoming patch to back untracked files up when
they're replaced by tracked ones.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -483,7 +483,7 @@ def overridecalculateupdates(origfn, rep
         if sm in ('g', 'dc') and lm != 'r':
             if sm == 'dc':
                 f1, f2, fa, move, anc = sargs
-                sargs = (p2[f2].flags(),)
+                sargs = (p2[f2].flags(), False)
             # Case 1: normal file in the working copy, largefile in
             # the second parent
             usermsg = _('remote turned local normal file %s into a largefile\n'
@@ -501,7 +501,7 @@ def overridecalculateupdates(origfn, rep
         elif lm in ('g', 'dc') and sm != 'r':
             if lm == 'dc':
                 f1, f2, fa, move, anc = largs
-                largs = (p2[f2].flags(),)
+                largs = (p2[f2].flags(), False)
             # Case 2: largefile in the working copy, normal file in
             # the second parent
             usermsg = _('remote turned local largefile %s into a normal file\n'
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -588,7 +588,8 @@ def _checkunknownfiles(repo, wctx, mctx,
 
     for f, (m, args, msg) in actions.iteritems():
         if m == 'c':
-            actions[f] = ('g', args, msg)
+            flags, = args
+            actions[f] = ('g', (flags, False), msg)
         elif m == 'cm':
             fl2, anc = args
             different = _checkunknownfile(repo, wctx, mctx, f)
@@ -596,7 +597,7 @@ def _checkunknownfiles(repo, wctx, mctx,
                 actions[f] = ('m', (f, f, None, False, anc),
                               "remote differs from untracked local")
             else:
-                actions[f] = ('g', (fl2,), "remote created")
+                actions[f] = ('g', (fl2, False), "remote created")
 
 def _forgetremoved(wctx, mctx, branchmerge):
     """
@@ -748,11 +749,11 @@ def manifestmerge(repo, wctx, p2, pa, br
                     if n1 == n2: # optimization: keep local content
                         actions[f] = ('e', (fl2,), "update permissions")
                     else:
-                        actions[f] = ('g', (fl2,), "remote is newer")
+                        actions[f] = ('g', (fl2, False), "remote is newer")
                 elif nol and n2 == a: # remote only changed 'x'
                     actions[f] = ('e', (fl2,), "update permissions")
                 elif nol and n1 == a: # local only changed 'x'
-                    actions[f] = ('g', (fl1,), "remote is newer")
+                    actions[f] = ('g', (fl1, False), "remote is newer")
                 else: # both changed something
                     actions[f] = ('m', (f, f, f, False, pa.node()),
                                    "versions differ")
@@ -1459,7 +1460,7 @@ def update(repo, node, branchmerge, forc
                 _("remote changed %s which local deleted\n"
                   "use (c)hanged version or leave (d)eleted?"
                   "$$ &Changed $$ &Deleted") % f, 0) == 0:
-                actions['g'].append((f, (flags,), "prompt recreating"))
+                actions['g'].append((f, (flags, False), "prompt recreating"))
 
         # divergent renames
         for f, fl in sorted(diverge.iteritems()):


More information about the Mercurial-devel mailing list