changeset 8173:d3fb413667e5

transplant: remove the restriction that the destination be nonempty. Test fixed by Patrick Mezard <pmezard@gmail.com>
author Jacob Lee <artdent@gmail.com>
date Fri, 24 Apr 2009 17:00:18 -0500
parents 36b935cad495
children 29bc5d18714a
files hgext/transplant.py tests/test-transplant tests/test-transplant.out
diffstat 3 files changed, 42 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/transplant.py	Sat Apr 25 21:27:47 2009 +0800
+++ b/hgext/transplant.py	Fri Apr 24 17:00:18 2009 -0500
@@ -528,8 +528,6 @@
     tp = transplanter(ui, repo)
 
     p1, p2 = repo.dirstate.parents()
-    if p1 == revlog.nullid:
-        raise util.Abort(_('no revision checked out'))
     if not opts.get('continue'):
         if p2 != revlog.nullid:
             raise util.Abort(_('outstanding uncommitted merges'))
--- a/tests/test-transplant	Sat Apr 25 21:27:47 2009 +0800
+++ b/tests/test-transplant	Fri Apr 24 17:00:18 2009 -0500
@@ -114,3 +114,22 @@
 echo % tranplant
 hg transplant -m 1
 cd ..
+
+echo '% test transplant into empty repository'
+hg init empty
+cd empty
+hg transplant -s ../t -b tip -a
+cd ..
+
+echo '% test filter'
+hg init filter
+cd filter
+cat <<'EOF' >test-filter
+#!/bin/sh
+sed 's/r1/r2/' $1 > $1.new
+mv $1.new $1
+EOF
+chmod +x test-filter
+hg transplant -s ../t -b tip -a --filter ./test-filter |\
+    sed 's/filtering.*/filtering/g'
+hg log --template '{rev} {parents} {desc}\n'
--- a/tests/test-transplant.out	Sat Apr 25 21:27:47 2009 +0800
+++ b/tests/test-transplant.out	Fri Apr 24 17:00:18 2009 -0500
@@ -136,3 +136,26 @@
 % tranplant
 applying 42dc4432fd35
 1:42dc4432fd35 merged at a9f4acbac129
+% test transplant into empty repository
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 4 changesets with 4 changes to 4 files
+% test filter
+filtering
+applying 17ab29e464c6
+17ab29e464c6 transplanted to e9ffc54ea104
+filtering
+applying 37a1297eb21b
+37a1297eb21b transplanted to 348b36d0b6a5
+filtering
+applying 722f4667af76
+722f4667af76 transplanted to 0aa6979afb95
+filtering
+applying a53251cdf717
+a53251cdf717 transplanted to 14f8512272b5
+3  b3
+2  b2
+1  b1
+0  r2