sapling/hgext/largefiles
FUJIWARA Katsunori d98ab37761 largefiles: synchronize lfdirstate with dirstate after automated committing
Before this patch, after successful "hg rebase" of the revision
removing largefiles, "hg status" may still show ""R" for such
largefiles unexpectedly.

"lfilesrepo.commit" executes the special code path for automated
committing while rebase/transplant, and lfdirstate entries for removed
files aren't updated in this code path, even after successful
committing.

Then, "R" entries still existing in lfdirstate cause unexpected "hg
status" output.

This patch synchronizes lfdirstate with dirstate after automated
committing.

This patch passes False as "normallookup" to "synclfdirstate", because
modified files in "files()" of the recent (= just committed) context
should be "normal"-ed.

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, lfdirstate should
be updated with dirstate simultaneously. Hooking "markcommitted" of
ctx in "localrepository.commitctx" may achieve this.

This problem occurs, only when (1) the parent of the working directory
is rebased and (2) it removes largefiles, because:

  - if the parent of the working directory isn't rebased, returning to
    the initial revision (= update) after rebase hides this problem

  - files added on "other" branch (= rebase target) are treated not as
    "added" but as "modified" (= "normal" status and "unset"
    timestamp) at merging

This patch tests also the status of added largefile, but it is only
for avoiding regression.

In addition to conditions above, "hg status" must not take existing
files to reproduce this problem, because existing files make
"match._files" not empty in "lfilesrepo.status" code path below:

    def sfindirstate(f):
        sf = lfutil.standin(f)
        dirstate = self.dirstate
        return sf in dirstate or sf in dirstate.dirs()

    match._files = [f for f in match._files
                    if sfindirstate(f)]

Not empty "match._files" prevents "status" on lfdirstate from
returning the result containing problematic "R" files.

This is reason why "large1" (removed) and "largeX" (added) are checked
separately in this patch.

Problematic code path in "lfilesrepo.commit" is used also by "hg
transplant", but this problem doesn't occur at "hg transplant",
because invocation of "updatelfiles" after transplant-ing in
"overridetransplant" causes cleaning lfdirstate up.

This patch tests also "hg transplant" as same as "hg rebase", but it
is only for avoiding regression.
2014-08-11 22:29:43 +09:00
..
__init__.py largefiles: define norepo in command decorator 2014-05-04 21:11:15 -07:00
basestore.py largefiles: hide passwords in URLs in ui messages 2013-10-17 16:13:15 +08:00
CONTRIBUTORS hgext: add largefiles extension 2011-09-24 17:35:45 +02:00
lfcommands.py largefiles: factor out synchronization of lfdirstate for future use 2014-08-11 22:29:43 +09:00
lfutil.py largefiles: factor out synchronization of lfdirstate for future use 2014-08-11 22:29:43 +09:00
localstore.py largefiles: don't close the fd passed to store._getfile 2013-04-15 23:47:04 +02:00
overrides.py largefiles: drop orphan entries from lfdristat at "hg rollback" 2014-08-11 22:29:43 +09:00
proto.py largefiles: import whole modules instead of importing parts of them 2014-04-08 00:48:36 +02:00
remotestore.py largefiles: import whole modules instead of importing parts of them 2014-04-08 00:48:36 +02:00
reposetup.py largefiles: synchronize lfdirstate with dirstate after automated committing 2014-08-11 22:29:43 +09:00
uisetup.py largefiles: import whole modules instead of importing parts of them 2014-04-08 00:48:36 +02:00
wirestore.py largefiles: stat all largefiles in one batch before downloading 2013-04-15 23:37:43 +02:00