[PATCH 2 of 4] largefiles: update standins only at the 1st commit of "transplant --continue"

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Nov 7 09:52:06 CST 2014


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1415375321 -32400
#      Sat Nov 08 00:48:41 2014 +0900
# Node ID a8cd62059369d30589cf45ffafd0f8d5ce76daf3
# Parent  3bdc023bdf819da681a4e94f9d3741749372b664
largefiles: update standins only at the 1st commit of "transplant --continue"

Before this patch, "hg transplant --continue" may record incorrect
standins, because largefiles extension always avoid updating standins
while transplanting, even though largefiles in the working directory
may be modified manually at the 1st commit of "hg transplant --continue".

But, on the other hand, updating standins should be avoided at
subsequent commits for efficiency reason.

To update standins only at the 1st commit of "hg transplant
--continue", this patch uses "automatedcommithook", which updates
standins by "lfutil.updatestandinsbymatch()" only at the 1st commit of
resuming.

Even after this patch, "repo._istransplanting = True" is still needed
to avoid some status report while updating largefiles in
"lfcommands.updatelfiles()".

This is reason why this patch omits not "repo._istransplanting = True"
in "overriderebase" but examination of "getattr(repo,
"_istransplanting", False)" in "updatestandinsbymatch".

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -447,18 +447,6 @@
 
     ui = repo.ui
 
-    # Case 0: Automated committing
-    #
-    # While automated committing (like rebase, transplant
-    # and so on), this code path is used to avoid:
-    # (1) updating standins, because standins should
-    #     be already updated at this point
-    # (2) aborting when standins are matched by "match",
-    #     because automated committing may specify them directly
-    #
-    if getattr(repo, "_istransplanting", False):
-        return match
-
     # Case 1: user calls commit with no specific files or
     # include/exclude patterns: refresh and commit all files that
     # are "dirty".
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1168,11 +1168,14 @@
     return result
 
 def overridetransplant(orig, ui, repo, *revs, **opts):
+    resuming = opts.get('continue')
+    repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
     try:
         repo._istransplanting = True
         result = orig(ui, repo, *revs, **opts)
     finally:
         repo._istransplanting = False
+        repo._lfcommithooks.pop()
     return result
 
 def overridecat(orig, ui, repo, file1, *pats, **opts):
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
@@ -560,6 +560,20 @@
   $ cat largeX
   largeX
 
+Test that transplant updates standins for manually modified largefiles
+at the 1st commit of resuming.
+
+  $ echo "manually modified before 'hg transplant --continue'" > large1
+  $ hg transplant --continue
+  07d6153b5c04 transplanted as f1bf30eb88cc
+  $ hg diff -c tip .hglf/large1 | grep '^[+-][0-9a-z]'
+  -e5bb990443d6a92aaf7223813720f7566c9dd05b
+  +6a4f36d4075fbe0f30ec1d26ca44e63c05903671
+  $ rm -f large1
+  $ hg update -q -C tip
+  $ cat large1
+  manually modified before 'hg transplant --continue'
+
 Test that "hg status" doesn't show removal of largefiles not managed
 in the target context.
 


More information about the Mercurial-devel mailing list