[PATCH 2 of 6] merge: move constant assignments a bit and use them more

Mads Kiilerich mads at kiilerich.com
Wed May 14 19:22:13 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1400112899 -7200
#      Thu May 15 02:14:59 2014 +0200
# Node ID d8fb8e30fc55f52e2dfc91726d518f57a3245d76
# Parent  0bb11b6b335f27382c7acf0f8a17558ecbe3c76a
merge: move constant assignments a bit and use them more

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -650,6 +650,9 @@ def applyupdates(repo, actions, wctx, mc
                 moves.append(f1)
 
     audit = repo.wopener.audit
+    _updating = _('updating')
+    _files = _('files')
+    progress = repo.ui.progress
 
     # remove renamed files after safely stored
     for f in moves:
@@ -670,27 +673,24 @@ def applyupdates(repo, actions, wctx, mc
     if hgsub and hgsub[0] == 'r':
         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
 
+    # remove in parallel (must come first)
     z = 0
     prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite),
                          removeactions)
     for i, item in prog:
         z += i
-        repo.ui.progress(_('updating'), z, item=item, total=numupdates,
-                         unit=_('files'))
+        progress(_updating, z, item=item, total=numupdates, unit=_files)
+
+    # get in parallel
     prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite),
                          updateactions)
     for i, item in prog:
         z += i
-        repo.ui.progress(_('updating'), z, item=item, total=numupdates,
-                         unit=_('files'))
+        progress(_updating, z, item=item, total=numupdates, unit=_files)
 
     if hgsub and hgsub[0] == 'g':
         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
 
-    _updating = _('updating')
-    _files = _('files')
-    progress = repo.ui.progress
-
     for i, a in enumerate(actions):
         f, m, args, msg = a
         progress(_updating, z + i + 1, item=f, total=numupdates, unit=_files)


More information about the Mercurial-devel mailing list