Patchwork [3,of,7,v2] merge: move constant assignments a bit and use them more

login
register
mail settings
Submitter Mads Kiilerich
Date May 9, 2014, 12:06 a.m.
Message ID <d0db23840ee70f9d85ee.1399593967@localhost.localdomain>
Download mbox | patch
Permalink /patch/4680/
State Superseded
Commit 26b84128c54d5608ae2db97c98ec401855bd8169
Headers show

Comments

Mads Kiilerich - May 9, 2014, 12:06 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1399593247 -7200
#      Fri May 09 01:54:07 2014 +0200
# Node ID d0db23840ee70f9d85ee4ce55b9cbef3be8dfc1b
# Parent  8b9f6a2e0d19791662c8c8544594a74c0d0d4276
merge: move constant assignments a bit and use them more

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -630,6 +630,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:
@@ -650,27 +653,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)