diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -12,7 +12,7 @@ import os import copy from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \ - archival, merge, pathutil, revset + archival, pathutil, revset from mercurial.i18n import _ from mercurial.node import hex from hgext import rebase @@ -1202,8 +1202,18 @@ def overriderollback(orig, ui, repo, **o if before == after: return result # no need to restore standins - merge.update(repo, node='.', branchmerge=False, force=True, - partial=lfutil.isstandin) + pctx = repo['.'] + for f in repo.dirstate: + if lfutil.isstandin(f): + if repo.dirstate[f] == 'r': + repo.wvfs.unlinkpath(f, ignoremissing=True) + elif f in pctx: + fctx = pctx[f] + repo.wwrite(f, fctx.data(), fctx.flags()) + else: + # content of standin is not so important in 'a', + # 'm' or 'n' (coming from the 2nd parent) cases + lfutil.writestandin(repo, f, '', False) lfdirstate = lfutil.openlfdirstate(ui, repo) orphans = set(lfdirstate) diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t --- a/tests/test-largefiles-update.t +++ b/tests/test-largefiles-update.t @@ -103,9 +103,15 @@ Test that "hg rollback" restores status $ hg update -C -q $ hg remove large1 + $ test -f .hglf/large1 + [1] $ hg forget large2 + $ test -f .hglf/large2 + [1] $ echo largeX > largeX $ hg add --large largeX + $ cat .hglf/largeX + $ hg commit -m 'will be rollback-ed soon' $ echo largeY > largeY $ hg add --large largeY @@ -122,10 +128,16 @@ Test that "hg rollback" restores status working directory now based on revision 3 $ hg status -A large1 R large1 + $ test -f .hglf/large1 + [1] $ hg status -A large2 R large2 + $ test -f .hglf/large2 + [1] $ hg status -A largeX A largeX + $ cat .hglf/largeX + $ hg status -A largeY ? largeY