largefiles: fix transplant for all cases (issue3192) stable
authorNa'Tosha Bard <natosha@unity3d.com>
Wed, 25 Jan 2012 14:10:01 +0100
branchstable
changeset 15982 bf502ccc46d7
parent 15981 1b3d952f1544
child 15983 32b9aee3602c
largefiles: fix transplant for all cases (issue3192)
hgext/largefiles/overrides.py
hgext/largefiles/reposetup.py
tests/test-largefiles.t
--- a/hgext/largefiles/overrides.py	Wed Jan 25 03:01:19 2012 +0700
+++ 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
--- a/hgext/largefiles/reposetup.py	Wed Jan 25 03:01:19 2012 +0700
+++ 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
--- a/tests/test-largefiles.t	Wed Jan 25 03:01:19 2012 +0700
+++ 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