[PATCH] largefiles: fix transplant for all cases (issue3192)

Na'Tosha Bard natosha at unity3d.com
Wed Jan 25 07:13:31 CST 2012


# HG changeset patch
# User Na'Tosha Bard <natosha at unity3d.com>
# Date 1327497001 -3600
# Branch stable
# Node ID 841d574c2f911c1c6465d36c83ccc25829553c10
# Parent  c2e6c5ef45555ff98dd12bef335c40a91eccc390
largefiles: fix transplant for all cases (issue3192)

diff -r c2e6c5ef4555 -r 841d574c2f91 hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Tue Jan 24 17:17:37 2012 -0600
+++ b/hgext/largefiles/overrides.py	Wed Jan 25 14:10:01 2012 +0100
@@ -952,6 +952,11 @@
     return result
 
 def override_transplant(orig, ui, repo, *revs, **opts):
-    result = orig(ui, repo, *revs, **opts)
-    lfcommands.updatelfiles(repo.ui, repo)
+    try:
+        repo._istransplanting = True
+        result = orig(ui, repo, *revs, **opts)
+        lfcommands.updatelfiles(ui, repo, filelist=None,
+                                printmessage=False)
+    finally:
+        repo._istransplanting = False
     return result
diff -r c2e6c5ef4555 -r 841d574c2f91 hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Tue Jan 24 17:17:37 2012 -0600
+++ b/hgext/largefiles/reposetup.py	Wed Jan 25 14:10:01 2012 +0100
@@ -268,15 +268,17 @@
 
             wlock = repo.wlock()
             try:
-                # Case 0: Rebase
+                # Case 0: Rebase or Transplant
                 # We have to take the time to pull down the new largefiles now.
-                # Otherwise if we are rebasing, any largefiles that were
-                # modified in the destination changesets get overwritten, either
-                # by the rebase or in the first commit after the rebase.
+                # Otherwise, any largefiles that were modified in the
+                # destination changesets get overwritten, either by the rebase
+                # or in the first commit after the rebase or transplant.
                 # updatelfiles will update the dirstate to mark any pulled
                 # largefiles as modified
-                if getattr(repo, "_isrebasing", False):
-                    lfcommands.updatelfiles(repo.ui, repo)
+                if getattr(repo, "_isrebasing", False) or \
+                        getattr(repo, "_istransplanting", False):
+                    lfcommands.updatelfiles(repo.ui, repo, filelist=None,
+                                            printmessage=False)
                     result = orig(text=text, user=user, date=date, match=match,
                                     force=force, editor=editor, extra=extra)
                     return result
diff -r c2e6c5ef4555 -r 841d574c2f91 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Tue Jan 24 17:17:37 2012 -0600
+++ b/tests/test-largefiles.t	Wed Jan 25 14:10:01 2012 +0100
@@ -423,8 +423,6 @@
   adding manifests
   adding file changes
   added 1 changesets with 2 changes to 2 files (+1 heads)
-  getting changed largefiles
-  1 largefiles updated, 0 removed
   Invoking status precommit hook
   M sub/normal4
   M sub2/large6
@@ -463,8 +461,6 @@
   caching new largefiles
   0 largefiles cached
   $ hg rebase
-  getting changed largefiles
-  1 largefiles updated, 0 removed
   Invoking status precommit hook
   M sub/normal4
   M sub2/large6
@@ -730,8 +726,6 @@
   adding manifests
   adding file changes
   added 1 changesets with 2 changes to 2 files
-  getting changed largefiles
-  1 largefiles updated, 0 removed
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
   9:598410d3eb9a  modify normal file largefile in repo d
   8:a381d2c8c80e  modify normal file and largefile in repo b


More information about the Mercurial-devel mailing list