diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -435,7 +435,8 @@ def downloadlfiles(ui, repo, rev=None): ui.status(_("%d largefiles failed to download\n") % totalmissing) return totalsuccess, totalmissing -def updatelfiles(ui, repo, filelist=None, printmessage=True): +def updatelfiles(ui, repo, filelist=None, printmessage=True, + normallookup=False): wlock = repo.wlock() try: lfdirstate = lfutil.openlfdirstate(ui, repo) @@ -516,7 +517,7 @@ def updatelfiles(ui, repo, filelist=None else: state, mtime = '?', -1 if state == 'n': - if mtime < 0: + if normallookup or mtime < 0: # state 'n' doesn't ensure 'clean' in this case lfdirstate.normallookup(lfile) else: diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -667,7 +667,13 @@ def overriderevert(orig, ui, repo, *pats newstandins = lfutil.getstandinsstate(repo) filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) - lfcommands.updatelfiles(ui, repo, filelist, printmessage=False) + # lfdirstate should be 'normallookup'-ed for updated files, + # because reverting doesn't touch dirstate for 'normal' files + # when target revision is explicitly specified: in such case, + # 'n' and valid timestamp in dirstate doesn't ensure 'clean' + # of target (standin) file. + lfcommands.updatelfiles(ui, repo, filelist, printmessage=False, + normallookup=True) 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 @@ -79,4 +79,24 @@ Test that "hg merge" updates largefiles $ cat .hglf/large1 58e24f733a964da346e2407a2bee99d9001184f5 +Test that "hg revert -r REV" updates largefiles from "REV" correctly + + $ hg update -q -C 3 + $ hg status -A large1 + C large1 + $ cat large1 + large1 in #3 + $ cat .hglf/large1 + e5bb990443d6a92aaf7223813720f7566c9dd05b + $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]' + -4669e532d5b2c093a78eca010077e708a071bb64 + +58e24f733a964da346e2407a2bee99d9001184f5 + $ hg revert --no-backup -r 1 --config debug.dirstate.delaywrite=2 large1 + $ hg status -A large1 + M large1 + $ cat large1 + large1 in #1 + $ cat .hglf/large1 + 58e24f733a964da346e2407a2bee99d9001184f5 + $ cd ..