changeset 52:fb1d911bb0be

svnclone now updates to the tip revision if it is the initial clone.
author Augie Fackler <durin42@gmail.com>
date Sat, 01 Nov 2008 13:40:19 -0500
parents fd5aadd552c8
children b61d49e3f91c
files __init__.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/__init__.py
+++ b/__init__.py
@@ -1,3 +1,5 @@
+import os
+
 from mercurial import commands
 from mercurial import hg
 
@@ -11,7 +13,12 @@ def svn_fetch(ui, svn_url, hg_repo_path=
     if not hg_repo_path:
         hg_repo_path = hg.defaultdest(svn_url) + "-hg"
         ui.status("Assuming destination %s\n" % hg_repo_path)
-    return fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts)
+    should_update = not os.path.exists(hg_repo_path)
+    res = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts)
+    if (res is None or res == 0) and should_update:
+        repo = hg.repository(ui, hg_repo_path)
+        commands.update(ui, repo, repo['tip'].node())
+    return res
 
 commands.norepo += " svnclone"
 cmdtable = {