[PATCH 2 of 3] largefiles: fix bad bug where transplanting a changeset with a largefile will result in an old largefile being comitted later on

Na'Tosha Bard natosha at unity3d.com
Fri Oct 28 11:54:09 CDT 2011


# HG changeset patch
# User Na'Tosha Bard <natosha at unity3d.com>
# Date 1319820504 -7200
# Node ID 32ad9c5195d9543d0123c4e0d1b906a0c68c3edb
# Parent  c16217607b25c58856f49bbd12479c76720e763e
largefiles: fix bad bug where transplanting a changeset with a largefile will result in an old largefile being comitted later on

diff -r c16217607b25 -r 32ad9c5195d9 hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Fri Oct 28 18:17:44 2011 +0200
+++ b/hgext/largefiles/overrides.py	Fri Oct 28 18:48:24 2011 +0200
@@ -828,3 +828,8 @@
             lfdirstate.add(file)
     lfdirstate.write()
     return result
+
+def override_transplant(orig, ui, repo, *revs, **opts):
+	result = orig(ui, repo, *revs, **opts)
+	lfcommands.updatelfiles(repo.ui, repo)
+	return result
diff -r c16217607b25 -r 32ad9c5195d9 hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py	Fri Oct 28 18:17:44 2011 +0200
+++ b/hgext/largefiles/uisetup.py	Fri Oct 28 18:48:24 2011 +0200
@@ -136,3 +136,6 @@
         if name == 'rebase':
             extensions.wrapcommand(getattr(module, 'cmdtable'), 'rebase',
                 overrides.override_rebase)
+        if name == 'transplant':
+            extensions.wrapcommand(getattr(module, 'cmdtable'), 'transplant',
+                overrides.override_transplant)
diff -r c16217607b25 -r 32ad9c5195d9 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Fri Oct 28 18:17:44 2011 +0200
+++ b/tests/test-largefiles.t	Fri Oct 28 18:48:24 2011 +0200
@@ -3,6 +3,7 @@
   > largefiles=
   > purge=
   > rebase=
+  > transplant=
   > [largefiles]
   > size=2
   > patterns=glob:**.dat
@@ -451,3 +452,88 @@
   $ echo "largeasnormal" > sub2/large7
   $ hg add sub2/large7
   sub2/large7 already a largefile
+
+Test that transplanting a largefile change works correctly.
+
+  $ cd ..
+  $ hg clone -r 8 d e 
+  adding changesets
+  adding manifests
+  adding file changes
+  added 9 changesets with 26 changes to 10 files
+  updating to branch default
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  3 largefiles updated, 0 removed
+  $ cd e
+  $ hg transplant -s ../d 598410d3eb9a 
+  searching for changes
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 2 changes to 2 files
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ hg log
+  changeset:   9:598410d3eb9a
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify normal file largefile in repo d
+  
+  changeset:   8:a381d2c8c80e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify normal file and largefile in repo b
+  
+  changeset:   7:daea875e9014
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add/edit more largefiles
+  
+  changeset:   6:4355d653f84f
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     edit files yet again
+  
+  changeset:   5:9d5af5072dbd
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     edit files again
+  
+  changeset:   4:74c02385b94c
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     move files
+  
+  changeset:   3:9e8fbc4bce62
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     copy files
+  
+  changeset:   2:51a0ae4d5864
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     remove files
+  
+  changeset:   1:ce8896473775
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     edit files
+  
+  changeset:   0:30d30fe6a5be
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add files
+  
+  $ cat normal3
+  normal3-modified
+  $ cat sub/normal4
+  normal4-modified
+  $ cat sub/large4
+  large4-modified
+  $ cat sub2/large6
+  large6-modified
+  $ cat sub2/large7
+  large7


More information about the Mercurial-devel mailing list