clone: if "url#rev" was given, update to rev
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Mon, 27 Aug 2007 01:44:35 -0300
changeset 5223 fe55e3d6dc0b
parent 5222 cbe6e263357b
child 5224 20817af258d8
clone: if "url#rev" was given, update to rev
mercurial/hg.py
tests/test-url-rev
tests/test-url-rev.out
--- a/mercurial/hg.py	Mon Aug 27 01:44:35 2007 -0300
+++ b/mercurial/hg.py	Mon Aug 27 01:44:35 2007 -0300
@@ -225,10 +225,11 @@
             dest_lock.release()
 
         if update:
-            try:
-                checkout = dest_repo.lookup("default")
-            except:
-                checkout = dest_repo.changelog.tip()
+            if not checkout:
+                try:
+                    checkout = dest_repo.lookup("default")
+                except:
+                    checkout = dest_repo.changelog.tip()
             _update(dest_repo, checkout)
 
     return src_repo, dest_repo
--- a/tests/test-url-rev	Mon Aug 27 01:44:35 2007 -0300
+++ b/tests/test-url-rev	Mon Aug 27 01:44:35 2007 -0300
@@ -12,7 +12,10 @@
 
 echo '% clone repo#foo'
 hg clone 'repo#foo' clone
+echo '% heads'
 hg --cwd clone heads
+echo '% parents'
+hg --cwd clone parents
 sed -e 's/default.*#/default = #/' clone/.hg/hgrc
 echo
 
--- a/tests/test-url-rev.out	Mon Aug 27 01:44:35 2007 -0300
+++ b/tests/test-url-rev.out	Mon Aug 27 01:44:35 2007 -0300
@@ -6,6 +6,15 @@
 adding file changes
 added 2 changesets with 2 changes to 1 files
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% heads
+changeset:   1:cd2a86ecc814
+branch:      foo
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change a
+
+% parents
 changeset:   1:cd2a86ecc814
 branch:      foo
 tag:         tip