changeset 22283:cb556ea76dcd

largefiles: omit restoring standins if working parent is not rollbacked For efficiency, this patch omits restoring standins and updating lfdirstate, if the parent of the working directory is not rollbacked. This patch adds the test not to confirm whether restoring is skipped or not, but to detect unexpected regression in the future: it is difficult to distinguish between skipping and perfectly restoring.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 24 Aug 2014 23:47:25 +0900
parents 4092d12ba18a
children 72b378658cff
files hgext/largefiles/overrides.py tests/test-largefiles-update.t
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Tue Aug 26 13:11:53 2014 +0200
+++ b/hgext/largefiles/overrides.py	Sun Aug 24 23:47:25 2014 +0900
@@ -1196,7 +1196,12 @@
 def overriderollback(orig, ui, repo, **opts):
     wlock = repo.wlock()
     try:
+        before = repo.dirstate.parents()
         result = orig(ui, repo, **opts)
+        after = repo.dirstate.parents()
+        if before == after:
+            return result # no need to restore standins
+
         merge.update(repo, node=None, branchmerge=False, force=True,
                      partial=lfutil.isstandin)
 
--- a/tests/test-largefiles-update.t	Tue Aug 26 13:11:53 2014 +0200
+++ b/tests/test-largefiles-update.t	Sun Aug 24 23:47:25 2014 +0900
@@ -129,6 +129,29 @@
   $ hg status -A largeY
   ? largeY
 
+Test that "hg rollback" restores standins correctly
+
+  $ hg commit -m 'will be rollback-ed soon'
+  $ hg update -q -C 2
+  $ cat large1
+  large1
+  $ cat .hglf/large1
+  4669e532d5b2c093a78eca010077e708a071bb64
+  $ cat large2
+  large2 in #2
+  $ cat .hglf/large2
+  3cfce6277e7668985707b6887ce56f9f62f6ccd9
+
+  $ hg rollback -q -f
+  $ cat large1
+  large1
+  $ cat .hglf/large1
+  4669e532d5b2c093a78eca010077e708a071bb64
+  $ cat large2
+  large2 in #2
+  $ cat .hglf/large2
+  3cfce6277e7668985707b6887ce56f9f62f6ccd9
+
 Test that "hg status" shows status of largefiles correctly just after
 automated commit like rebase/transplant