Patchwork [2,of,6] merge: make all action tuples have the same length - keep args as tuple

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 20, 2013, 1:18 p.m.
Message ID <b2dfabb82473acd0567f.1358687885@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/688/
State Superseded
Commit 26627c30735a610f59979a36885b327b25d8dbff
Headers show

Comments

Mads Kiilerich - Jan. 20, 2013, 1:18 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1358687872 -3600
# Branch stable
# Node ID b2dfabb82473acd0567f0205099dd180d121f41a
# Parent  8bf1218094bea9c7c0fd8f4d1187db131ad04cb4
merge: make all action tuples have the same length - keep args as tuple

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -368,7 +368,7 @@  def overridemanifestmerge(origfn, repo, 
         if overwrite:
             processed.append(action)
             continue
-        f, m = action[:2]
+        f, m, args = action
 
         choices = (_('&Largefile'), _('&Normal file'))
         if m == "g" and lfutil.splitstandin(f) in p1 and f in p2:
@@ -379,10 +379,10 @@  def overridemanifestmerge(origfn, repo, 
             msg = _('%s has been turned into a largefile\n'
                     'use (l)argefile or keep as (n)ormal file?') % lfile
             if repo.ui.promptchoice(msg, choices, 0) == 0:
-                processed.append((lfile, "r"))
-                processed.append((standin, "g", p2.flags(standin)))
+                processed.append((lfile, "r", None))
+                processed.append((standin, "g", (p2.flags(standin),)))
             else:
-                processed.append((standin, "r"))
+                processed.append((standin, "r", None))
         elif m == "g" and lfutil.standin(f) in p1 and f in p2:
             # Case 2: largefile in the working copy, normal file in
             # the second parent
@@ -391,10 +391,10 @@  def overridemanifestmerge(origfn, repo, 
             msg = _('%s has been turned into a normal file\n'
                     'keep as (l)argefile or use (n)ormal file?') % lfile
             if repo.ui.promptchoice(msg, choices, 0) == 0:
-                processed.append((lfile, "r"))
+                processed.append((lfile, "r", None))
             else:
-                processed.append((standin, "r"))
-                processed.append((lfile, "g", p2.flags(lfile)))
+                processed.append((standin, "r", None))
+                processed.append((lfile, "g", (p2.flags(lfile),)))
         else:
             processed.append(action)
 
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -176,12 +176,12 @@  def _forgetremoved(wctx, mctx, branchmer
     state = branchmerge and 'r' or 'f'
     for f in wctx.deleted():
         if f not in mctx:
-            actions.append((f, state))
+            actions.append((f, state, None))
 
     if not branchmerge:
         for f in wctx.removed():
             if f not in mctx:
-                actions.append((f, "f"))
+                actions.append((f, "f", None))
 
     return actions
 
@@ -195,7 +195,7 @@  def manifestmerge(repo, p1, p2, pa, over
 
     def act(msg, m, f, *args):
         repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
-        actions.append((f, m) + args)
+        actions.append((f, m, args))
 
     actions, copy, movewithdir = [], {}, {}
 
@@ -336,9 +336,9 @@  def applyupdates(repo, actions, wctx, mc
 
     # prescan for merges
     for a in actions:
-        f, m = a[:2]
+        f, m, args = a
         if m == "m": # merge
-            f2, fd, move = a[2:]
+            f2, fd, move = args
             if fd == '.hgsubstate': # merged internally
                 continue
             repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd))
@@ -368,7 +368,7 @@  def applyupdates(repo, actions, wctx, mc
 
     numupdates = len(actions)
     for i, a in enumerate(actions):
-        f, m = a[:2]
+        f, m, args = a
         repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates,
                          unit=_('files'))
         if m == "r": # remove
@@ -387,7 +387,7 @@  def applyupdates(repo, actions, wctx, mc
                 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
                                  overwrite)
                 continue
-            f2, fd, move = a[2:]
+            f2, fd, move = args
             audit(fd)
             r = ms.resolve(fd, wctx, mctx)
             if r is not None and r > 0:
@@ -398,14 +398,14 @@  def applyupdates(repo, actions, wctx, mc
                 else:
                     merged += 1
         elif m == "g": # get
-            flags = a[2]
+            flags, = args
             repo.ui.note(_("getting %s\n") % f)
             repo.wwrite(f, mctx.filectx(f).data(), flags)
             updated += 1
             if f == '.hgsubstate': # subrepo states need updating
                 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
         elif m == "d": # directory rename
-            f2, fd, flags = a[2:]
+            f2, fd, flags = args
             if f:
                 repo.ui.note(_("moving %s to %s\n") % (f, fd))
                 audit(f)
@@ -416,19 +416,19 @@  def applyupdates(repo, actions, wctx, mc
                 repo.wwrite(fd, mctx.filectx(f2).data(), flags)
             updated += 1
         elif m == "dr": # divergent renames
-            fl = a[2]
+            fl, = args
             repo.ui.warn(_("note: possible conflict - %s was renamed "
                            "multiple times to:\n") % f)
             for nf in fl:
                 repo.ui.warn(" %s\n" % nf)
         elif m == "rd": # rename and delete
-            fl = a[2]
+            fl, = args
             repo.ui.warn(_("note: possible conflict - %s was deleted "
                            "and renamed to:\n") % f)
             for nf in fl:
                 repo.ui.warn(" %s\n" % nf)
         elif m == "e": # exec
-            flags = a[2]
+            flags, = args
             audit(f)
             util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
             updated += 1
@@ -462,7 +462,7 @@  def recordupdates(repo, actions, branchm
     "record merge actions to the dirstate"
 
     for a in actions:
-        f, m = a[:2]
+        f, m, args = a
         if m == "r": # remove
             if branchmerge:
                 repo.dirstate.remove(f)
@@ -481,7 +481,7 @@  def recordupdates(repo, actions, branchm
             else:
                 repo.dirstate.normal(f)
         elif m == "m": # merge
-            f2, fd, move = a[2:]
+            f2, fd, move = args
             if branchmerge:
                 # We've done a branch merge, mark this file as merged
                 # so that we properly record the merger later
@@ -504,7 +504,7 @@  def recordupdates(repo, actions, branchm
                 if move:
                     repo.dirstate.drop(f)
         elif m == "d": # directory rename
-            f2, fd, flag = a[2:]
+            f2, fd, flag = args
             if not f2 and f not in repo.dirstate:
                 # untracked file moved
                 continue