diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1147,9 +1147,13 @@ def overriderollback(orig, ui, repo, **o partial=lfutil.isstandin) lfdirstate = lfutil.openlfdirstate(ui, repo) + orphans = set(lfdirstate) lfiles = lfutil.listlfiles(repo) for file in lfiles: lfutil.synclfdirstate(repo, lfdirstate, file, True) + orphans.discard(file) + for lfile in orphans: + lfdirstate.drop(lfile) lfdirstate.write() finally: wlock.release() 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 @@ -107,12 +107,16 @@ Test that "hg rollback" restores status $ echo largeX > largeX $ hg add --large largeX $ hg commit -m 'will be rollback-ed soon' + $ echo largeY > largeY + $ hg add --large largeY $ hg status -A large1 large1: No such file or directory $ hg status -A large2 ? large2 $ hg status -A largeX C largeX + $ hg status -A largeY + A largeY $ hg rollback repository tip rolled back to revision 3 (undo commit) working directory now based on revision 3 @@ -122,5 +126,7 @@ Test that "hg rollback" restores status R large2 $ hg status -A largeX A largeX + $ hg status -A largeY + ? largeY $ cd ..