[PATCH] localrepo: reduce scope of 'removed' variable

Martin von Zweigbergk martinvonz at gmail.com
Mon Oct 13 23:50:07 CDT 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at gmail.com>
# Date 1413243817 25200
#      Mon Oct 13 16:43:37 2014 -0700
# Node ID 1922ad32849078f123266c6a9bcf38074240eaf8
# Parent  e1d19753de23e299e80e78025aeca5bd3afb52e3
localrepo: reduce scope of 'removed' variable

The variable is closely related to 'added' and 'changed', so it makes
sense to have it declared next to them.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1378,7 +1378,6 @@
         """
 
         tr = None
-        removed = list(ctx.removed())
         p1, p2 = ctx.p1(), ctx.p2()
         user = ctx.user()
 
@@ -1395,6 +1394,7 @@
                 # check in files
                 added = []
                 changed = []
+                removed = list(ctx.removed())
                 linkrev = len(self)
                 for f in sorted(ctx.modified() + ctx.added()):
                     self.ui.note(f + "\n")


More information about the Mercurial-devel mailing list