clone: try updating to the actual changeset specified in options
authorBrett Carter <brett@rdnzl.net>
Thu, 14 May 2009 22:00:56 +0200
changeset 8417 39cf453da958
parent 8416 9dfee83c93c8
child 8419 94e07bb8e5dd
clone: try updating to the actual changeset specified in options When cloning with the -r option or # url format from a tag the destination repo most likely won't have the tag. We can save the lookup result to get to the correct parent anyway. Similar to issue1306, but for tags.
mercurial/hg.py
tests/test-tag
tests/test-tag.out
--- a/mercurial/hg.py	Thu May 14 13:24:39 2009 -0500
+++ b/mercurial/hg.py	Thu May 14 22:00:56 2009 +0200
@@ -219,7 +219,7 @@
                                        "lookup and so doesn't support clone by "
                                        "revision"))
                 revs = [src_repo.lookup(r) for r in rev]
-
+                checkout = revs[0]
             if dest_repo.local():
                 dest_repo.clone(src_repo, heads=revs, stream=stream)
             elif src_repo.local():
--- a/tests/test-tag	Thu May 14 13:24:39 2009 -0500
+++ b/tests/test-tag	Thu May 14 22:00:56 2009 +0200
@@ -1,6 +1,8 @@
 #!/bin/sh
 
-hg init
+hg init test
+cd test
+
 echo a > a
 hg add a
 hg commit -m "test" -d "1000000 0"
@@ -38,6 +40,17 @@
 newline'
 hg tag -l 'xx:xx'
 
+echo % cloning local tags
+cd ..
+hg -R test log -r0:5
+hg clone -q -rbleah1 test test1
+hg -R test1 parents --style=compact
+hg clone -q -r5 test#bleah1 test2
+hg -R test2 parents --style=compact
+hg clone -q -U test#bleah1 test3
+hg -R test3 parents --style=compact
+
+cd test
 echo % issue 601
 python << EOF
 f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
--- a/tests/test-tag.out	Thu May 14 13:24:39 2009 -0500
+++ b/tests/test-tag.out	Thu May 14 22:00:56 2009 +0200
@@ -47,6 +47,48 @@
 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
 abort: '\n' cannot be used in a tag name
 abort: ':' cannot be used in a tag name
+% cloning local tags
+changeset:   0:0acdaf898367
+tag:         foobar
+tag:         bleah
+tag:         bleah0
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     test
+
+changeset:   1:3ecf002a1c57
+tag:         bleah1
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     Added tag bleah for changeset 0acdaf898367
+
+changeset:   2:868cc8fbb43b
+tag:         gawk
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     Added tag bleah0 for changeset 0acdaf898367
+
+changeset:   3:3807bcf62c56
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     Added tag gack, gawk, gorp for changeset 868cc8fbb43b
+
+changeset:   4:140c6e8597b4
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     Added tag gack for changeset 3807bcf62c56
+
+changeset:   5:470a65fa7cc9
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     Removed tag gack, gorp
+
+1[tip]   3ecf002a1c57   1970-01-12 13:46 +0000   test
+  Added tag bleah for changeset 0acdaf898367
+
+5[tip]   470a65fa7cc9   1970-01-12 13:46 +0000   test
+  Removed tag gack, gorp
+
 % issue 601
 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah13ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
 f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline