Mercurial > hg-stable
changeset 22286:3f3b9483e7ef
largefiles: unlink standins not known to the restored dirstate at rollback
Before this patch, standinds not known to the restored dirstate at
rollback still exist after rollback of the parent of the working
directory, and they become orphans unexpectedly.
This patch unlinks standins not known to the restored dirstate.
This patch saves names of standins matched against not
"repo.dirstate[f] == 'a'" but "repo.dirstate[f] != 'r'" before
rollback, because branch merging marks files newly added to
dirstate as not "a" but "n".
Such standins will also become orphan after rollback, because they are
not known to the restored dirstate.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 24 Aug 2014 23:47:26 +0900 |
parents | 85bded43cc80 |
children | f3ac9677fa2b |
files | hgext/largefiles/overrides.py tests/test-largefiles-update.t |
diffstat | 2 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Sun Aug 24 23:47:25 2014 +0900 +++ b/hgext/largefiles/overrides.py Sun Aug 24 23:47:26 2014 +0900 @@ -1197,6 +1197,8 @@ wlock = repo.wlock() try: before = repo.dirstate.parents() + orphans = set(f for f in repo.dirstate + if lfutil.isstandin(f) and repo.dirstate[f] != 'r') result = orig(ui, repo, **opts) after = repo.dirstate.parents() if before == after: @@ -1205,6 +1207,7 @@ pctx = repo['.'] for f in repo.dirstate: if lfutil.isstandin(f): + orphans.discard(f) if repo.dirstate[f] == 'r': repo.wvfs.unlinkpath(f, ignoremissing=True) elif f in pctx: @@ -1214,6 +1217,8 @@ # content of standin is not so important in 'a', # 'm' or 'n' (coming from the 2nd parent) cases lfutil.writestandin(repo, f, '', False) + for standin in orphans: + repo.wvfs.unlinkpath(standin, ignoremissing=True) lfdirstate = lfutil.openlfdirstate(ui, repo) orphans = set(lfdirstate)