comparison __init__.py @ 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 f2636cfed115
children ed42f6e5705a
comparison
equal deleted inserted replaced
51:fd5aadd552c8 52:fb1d911bb0be
1 import os
2
1 from mercurial import commands 3 from mercurial import commands
2 from mercurial import hg 4 from mercurial import hg
3 5
4 import svncommand 6 import svncommand
5 import fetch_command 7 import fetch_command
9 11
10 def svn_fetch(ui, svn_url, hg_repo_path=None, **opts): 12 def svn_fetch(ui, svn_url, hg_repo_path=None, **opts):
11 if not hg_repo_path: 13 if not hg_repo_path:
12 hg_repo_path = hg.defaultdest(svn_url) + "-hg" 14 hg_repo_path = hg.defaultdest(svn_url) + "-hg"
13 ui.status("Assuming destination %s\n" % hg_repo_path) 15 ui.status("Assuming destination %s\n" % hg_repo_path)
14 return fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts) 16 should_update = not os.path.exists(hg_repo_path)
17 res = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts)
18 if (res is None or res == 0) and should_update:
19 repo = hg.repository(ui, hg_repo_path)
20 commands.update(ui, repo, repo['tip'].node())
21 return res
15 22
16 commands.norepo += " svnclone" 23 commands.norepo += " svnclone"
17 cmdtable = { 24 cmdtable = {
18 "svn": 25 "svn":
19 (svn, 26 (svn,