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

login
register
mail settings
Submitter Mads Kiilerich
Date May 1, 2014, 11:42 p.m.
Message ID <28162b4271a8a4c4cdee.1398987771@mk-desktop>
Download mbox | patch
Permalink /patch/4468/
State Superseded
Headers show

Comments

Mads Kiilerich - May 1, 2014, 11:42 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1398985754 -7200
#      Fri May 02 01:09:14 2014 +0200
# Branch stable
# Node ID 28162b4271a8a4c4cdee6532c49aa5316f9133d5
# Parent  b2bc5f722d74f14c1b90be2ec0af9b03d408143a
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)