changeset 5223:fe55e3d6dc0b

clone: if "url#rev" was given, update to rev
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 27 Aug 2007 01:44:35 -0300
parents cbe6e263357b
children 20817af258d8
files mercurial/hg.py tests/test-url-rev tests/test-url-rev.out
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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