From 1b49e33c21213eea5d611b9be987a941e8ff01a0 Mon Sep 17 00:00:00 2001 From: FUJIWARA Katsunori Date: Sun, 24 Aug 2014 23:47:25 +0900 Subject: [PATCH] largefiles: restore standins from non branch-tip parent at rollback correctly Before this patch, "hg rollback" can't restore standins correclty, if: - old parent of the working directory is rollback-ed, and - new parent of the working directory is not branch-tip "overriderollback" uses "merge.update" as a kind of "revert" utility to restore only standins with "node=None", and this makes "merge.update" choose "branch-tip" revision as the updating target unexpectedly. Then, "merge.update" restores standins from the branch-tip revision regardless of the parent of the working directory after rollback and this may cause unexpected behavior. This patch invokes "merge.update" with "node='.'" to restore standins from the parent revision of the working directory. In fact, this "merge.update" invocation will be replaced in the subsequent patch to fix another problem, but this change is usefull to inform reason why such complicated case should be tested. --- hgext/largefiles/overrides.py | 2 +- tests/test-largefiles-update.t | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py index 1be84230fe..7ff1465873 100644 --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1202,7 +1202,7 @@ def overriderollback(orig, ui, repo, **opts): if before == after: return result # no need to restore standins - merge.update(repo, node=None, branchmerge=False, force=True, + merge.update(repo, node='.', branchmerge=False, force=True, partial=lfutil.isstandin) lfdirstate = lfutil.openlfdirstate(ui, repo) diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t index 1bd1f16619..337bfb3469 100644 --- a/tests/test-largefiles-update.t +++ b/tests/test-largefiles-update.t @@ -152,6 +152,25 @@ Test that "hg rollback" restores standins correctly $ cat .hglf/large2 3cfce6277e7668985707b6887ce56f9f62f6ccd9 +(rollback the parent of the working directory, when the parent of it +is not branch-tip) + + $ hg update -q -C 1 + $ cat .hglf/large1 + 58e24f733a964da346e2407a2bee99d9001184f5 + $ cat .hglf/large2 + 1deebade43c8c498a3c8daddac0244dc55d1331d + + $ echo normalX > normalX + $ hg add normalX + $ hg commit -m 'will be rollback-ed soon' + $ hg rollback -q + + $ cat .hglf/large1 + 58e24f733a964da346e2407a2bee99d9001184f5 + $ cat .hglf/large2 + 1deebade43c8c498a3c8daddac0244dc55d1331d + Test that "hg status" shows status of largefiles correctly just after automated commit like rebase/transplant