Patchwork [8,of,8] localrepo: call _dirstatestatus instead of duplicating logic

login
register
mail settings
Submitter Sean Farley
Date May 6, 2014, 11:33 p.m.
Message ID <9ca39f52dd88e1afaa1f.1399419205@laptop.local>
Download mbox | patch
Permalink /patch/4653/
State Accepted
Commit 3b6b1b407e99f4d554eb367895d3de2cf4566b0e
Headers show

Comments

Sean Farley - May 6, 2014, 11:33 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1394580736 18000
#      Tue Mar 11 18:32:16 2014 -0500
# Node ID 9ca39f52dd88e1afaa1f89b1f84d6bf7fd15fcc3
# Parent  a2478cd201b77a44d2f9071d99ba3edc9b269359
localrepo: call _dirstatestatus instead of duplicating logic
Sean Farley - May 6, 2014, 11:46 p.m.
Sean Farley <sean.michael.farley@gmail.com> writes:

> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1394580736 18000
> #      Tue Mar 11 18:32:16 2014 -0500
> # Node ID 9ca39f52dd88e1afaa1f89b1f84d6bf7fd15fcc3
> # Parent  a2478cd201b77a44d2f9071d99ba3edc9b269359
> localrepo: call _dirstatestatus instead of duplicating logic

My entire work in progress is here:

https://smf.io/hg

but, basically, this is to remove the 'status' method of localrepo and
put it into the context object so that 'ctx1.status(ctx2)' works as
expected.

Next on the chopping block is moving repo.commit to committablectx :-)
Pierre-Yves David - May 15, 2014, 1:08 a.m.
On 05/06/2014 04:33 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1394580736 18000
> #      Tue Mar 11 18:32:16 2014 -0500
> # Node ID 9ca39f52dd88e1afaa1f89b1f84d6bf7fd15fcc3
> # Parent  a2478cd201b77a44d2f9071d99ba3edc9b269359
> localrepo: call _dirstatestatus instead of duplicating logic

And the three next one are queued and pushed.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1543,33 +1543,21 @@  class localrepository(object):
                 if f not in ctx1 and f not in ctx1.dirs():
                     self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg))
             match.bad = bad
 
         if working: # we need to scan the working dir
-            subrepos = []
-            if '.hgsub' in self.dirstate:
-                subrepos = sorted(ctx2.substate)
-            s = self.dirstate.status(match, subrepos, listignored,
-                                     listclean, listunknown)
-            cmp, modified, added, removed, deleted, unknown, ignored, clean = s
-
-            # check for any possibly clean files
-            if parentworking and cmp:
-                modified2, fixup = ctx2._checklookup(cmp)
-                modified += modified2
-
-                # update dirstate for files that are actually clean
-                if fixup and listclean:
-                    clean += fixup
+            r = ctx2._dirstatestatus(match=match, ignored=listignored,
+                                     clean=listclean, unknown=listunknown)
+            modified, added, removed, deleted, unknown, ignored, clean = r
 
         if not parentworking:
             mf1 = mfmatches(ctx1)
             if working:
                 # we are comparing working dir against non-parent
                 # generate a pseudo-manifest for the working dir
                 mf2 = mfmatches(self['.'])
-                for f in cmp + modified + added:
+                for f in modified + added:
                     mf2[f] = None
                     mf2.set(f, ctx2.flags(f))
                 for f in removed:
                     if f in mf2:
                         del mf2[f]