Submitter | Sean Farley |
---|---|
Date | May 6, 2014, 11:33 p.m. |
Message ID | <d556bbc7a4a12f0c644b.1399419203@laptop.local> |
Download | mbox | patch |
Permalink | /patch/4651/ |
State | Accepted |
Commit | 38743c59f3f88e99039a989f414e37d86e4eff91 |
Headers | show |
Comments
On 5/6/14, 4:33 PM, Sean Farley wrote: > # HG changeset patch > # User Sean Farley <sean.michael.farley@gmail.com> > # Date 1398190491 18000 > # Tue Apr 22 13:14:51 2014 -0500 > # Node ID d556bbc7a4a12f0c644be280a95c649f0d113437 > # Parent 2bb99e94978f9da3a6eb50bbddcbbfec28f399a1 > context: add private _dirstatestatus method > > This method is mostly a copy from workingctx.status. The custom status method You mean localrepo.status? This code doesn't exist in workingctx.status yet. > of workingctx will eventually be absorbed by the refactoring of > localrepo.status to context.status but unfortunately we can't do it in one > step. > > diff --git a/mercurial/context.py b/mercurial/context.py > --- a/mercurial/context.py > +++ b/mercurial/context.py > @@ -1213,10 +1213,33 @@ class workingctx(committablectx): > wlock.release() > except error.LockError: > pass > return modified, fixup > > + def _dirstatestatus(self, match=None, ignored=False, clean=False, > + unknown=False): > + '''Gets the status from the dirstate -- internal use only.''' > + listignored, listclean, listunknown = ignored, clean, unknown > + match = match or matchmod.always(self._repo.root, self._repo.getcwd()) > + subrepos = [] > + if '.hgsub' in self: > + subrepos = sorted(self.substate) > + s = self._repo.dirstate.status(match, subrepos, listignored, > + listclean, listunknown) > + cmp, modified, added, removed, deleted, unknown, ignored, clean = s > + > + # check for any possibly clean files > + if cmp: In localrepo.status, this line is 'if parentworking and cmp:' which implies that the code above could be used in a situation where we're not comparing against the parent, and that the code below should only be run if we are comparing against parent. So... how will that get handled now? > + modified2, fixup = self._checklookup(cmp) > + modified += modified2 > + > + # update dirstate for files that are actually clean > + if fixup and listclean: > + clean += fixup > + > + return [modified, added, removed, deleted, unknown, ignored, clean] > + > def status(self, ignored=False, clean=False, unknown=False): > """Explicit status query > Unless this method is used to query the working copy status, the > _status property will implicitly read the status using its default > arguments.""" >
Durham Goode <durham@fb.com> writes: > On 5/6/14, 4:33 PM, Sean Farley wrote: >> # HG changeset patch >> # User Sean Farley <sean.michael.farley@gmail.com> >> # Date 1398190491 18000 >> # Tue Apr 22 13:14:51 2014 -0500 >> # Node ID d556bbc7a4a12f0c644be280a95c649f0d113437 >> # Parent 2bb99e94978f9da3a6eb50bbddcbbfec28f399a1 >> context: add private _dirstatestatus method >> >> This method is mostly a copy from workingctx.status. The custom status method > You mean localrepo.status? This code doesn't exist in workingctx.status > yet. Oops, yep. I meant from localrepo.status. >> of workingctx will eventually be absorbed by the refactoring of >> localrepo.status to context.status but unfortunately we can't do it in one >> step. >> >> diff --git a/mercurial/context.py b/mercurial/context.py >> --- a/mercurial/context.py >> +++ b/mercurial/context.py >> @@ -1213,10 +1213,33 @@ class workingctx(committablectx): >> wlock.release() >> except error.LockError: >> pass >> return modified, fixup >> >> + def _dirstatestatus(self, match=None, ignored=False, clean=False, >> + unknown=False): >> + '''Gets the status from the dirstate -- internal use only.''' >> + listignored, listclean, listunknown = ignored, clean, unknown >> + match = match or matchmod.always(self._repo.root, self._repo.getcwd()) >> + subrepos = [] >> + if '.hgsub' in self: >> + subrepos = sorted(self.substate) >> + s = self._repo.dirstate.status(match, subrepos, listignored, >> + listclean, listunknown) >> + cmp, modified, added, removed, deleted, unknown, ignored, clean = s >> + >> + # check for any possibly clean files >> + if cmp: > In localrepo.status, this line is 'if parentworking and cmp:' which > implies that the code above could be used in a situation where we're not > comparing against the parent, and that the code below should only be run > if we are comparing against parent. So... how will that get handled now? This patch series is trying to get rid of the need to have a 'parentworking' variable at all and call the workingctx.status method directly. In other words, the 'parentworking' check will be done before calling this method. This helps remove the parentworking logic from this code.
Patch
diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1213,10 +1213,33 @@ class workingctx(committablectx): wlock.release() except error.LockError: pass return modified, fixup + def _dirstatestatus(self, match=None, ignored=False, clean=False, + unknown=False): + '''Gets the status from the dirstate -- internal use only.''' + listignored, listclean, listunknown = ignored, clean, unknown + match = match or matchmod.always(self._repo.root, self._repo.getcwd()) + subrepos = [] + if '.hgsub' in self: + subrepos = sorted(self.substate) + s = self._repo.dirstate.status(match, subrepos, listignored, + listclean, listunknown) + cmp, modified, added, removed, deleted, unknown, ignored, clean = s + + # check for any possibly clean files + if cmp: + modified2, fixup = self._checklookup(cmp) + modified += modified2 + + # update dirstate for files that are actually clean + if fixup and listclean: + clean += fixup + + return [modified, added, removed, deleted, unknown, ignored, clean] + def status(self, ignored=False, clean=False, unknown=False): """Explicit status query Unless this method is used to query the working copy status, the _status property will implicitly read the status using its default arguments."""