Patchwork [02,of,15,v2] lfutil: avoid creating unnecessary copy of status tuple

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 5, 2014, 6:07 a.m.
Message ID <065114309f6206ec11a4.1412489279@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6128/
State Superseded
Commit 3b8e6c095239b1a4c6641302519a3d0c7f54057a
Headers show

Comments

Martin von Zweigbergk - Oct. 5, 2014, 6:07 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412396480 25200
#      Fri Oct 03 21:21:20 2014 -0700
# Node ID 065114309f6206ec11a48dd088c287211467620b
# Parent  06cc871f960f4c22a81b2271ef235ff53f26cf4c
lfutil: avoid creating unnecessary copy of status tuple

In lfdirstatestatus(), the status tuple gets deconstructed, the lists
get updated, and then an identical status tuple gets created and
returned. Change it so we simply return the original tuple.

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -137,7 +137,7 @@ 
 def lfdirstatestatus(lfdirstate, repo, rev):
     match = match_.always(repo.root, repo.getcwd())
     unsure, s = lfdirstate.status(match, [], False, False, False)
-    modified, added, removed, missing, unknown, ignored, clean = s
+    modified, _added, _removed, _missing, _unknown, _ignored, clean = s
     for lfile in unsure:
         try:
             fctx = repo[rev][standin(lfile)]
@@ -148,7 +148,7 @@ 
         else:
             clean.append(lfile)
             lfdirstate.normal(lfile)
-    return (modified, added, removed, missing, unknown, ignored, clean)
+    return s
 
 def listlfiles(repo, rev=None, matcher=None):
     '''return a list of largefiles in the working copy or the