Patchwork [3,of,4,V2] context.status: avoid de- and reconstructing status tuple

login
register
mail settings
Submitter Martin von Zweigbergk
Date Nov. 14, 2014, 5:37 a.m.
Message ID <34d3d9e7197dcf37bd8f.1415943467@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6727/
State Accepted
Commit 3f269bd4826cccd22e238c8efca345cc7a345bf9
Headers show

Comments

Martin von Zweigbergk - Nov. 14, 2014, 5:37 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1415858851 28800
#      Wed Nov 12 22:07:31 2014 -0800
# Node ID 34d3d9e7197dcf37bd8f1d1ef1a8beeb7e44600a
# Parent  06026f6263e354382375d1c2f8f9141b4275ad4d
context.status: avoid de- and reconstructing status tuple

We can just modify the status tuple we got from dirstate.status()
instead of deconstructing it and constructing a new instance, thereby
simplifying the code a little.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1409,19 +1409,17 @@ 
             subrepos = sorted(self.substate)
         cmp, s = self._repo.dirstate.status(match, subrepos, listignored,
                                             listclean, listunknown)
-        modified, added, removed, deleted, unknown, ignored, clean = s
 
         # check for any possibly clean files
         if cmp:
             modified2, fixup = self._checklookup(cmp)
-            modified += modified2
+            s.modified.extend(modified2)
 
             # update dirstate for files that are actually clean
             if fixup and listclean:
-                clean += fixup
+                s.clean.extend(fixup)
 
-        return scmutil.status(modified, added, removed, deleted, unknown,
-                              ignored, clean)
+        return s
 
     def _buildstatus(self, other, s, match, listignored, listclean,
                      listunknown):