Cleanups for repo.pull
Use repo.pull in pull and clone commands
Teach clone about ssh:// (temporarily)
Fix up shutil issue on failed pull
--- a/mercurial/commands.py Tue Jul 05 17:55:22 2005 -0800
+++ b/mercurial/commands.py Tue Jul 05 18:12:57 2005 -0800
@@ -331,14 +331,15 @@
class dircleanup:
def __init__(self, dir):
+ import shutil
+ self.rmtree = shutil.rmtree
self.dir = dir
os.mkdir(dir)
def close(self):
self.dir = None
def __del__(self):
if self.dir:
- import shutil
- shutil.rmtree(self.dir, True)
+ self.rmtree(self.dir, True)
d = dircleanup(dest)
@@ -346,6 +347,7 @@
abspath = source
if not (source.startswith("http://") or
source.startswith("hg://") or
+ source.startswith("ssh://") or
source.startswith("old-http://")):
abspath = os.path.abspath(source)
d1 = os.stat(dest).st_dev
@@ -364,10 +366,7 @@
else:
repo = hg.repository(ui, dest, create=1)
other = hg.repository(ui, source)
- fetch = repo.findincoming(other)
- if fetch:
- cg = other.changegroup(fetch)
- repo.addchangegroup(cg)
+ repo.pull(other)
f = repo.opener("hgrc", "w")
f.write("[paths]\n")
@@ -694,18 +693,11 @@
def pull(ui, repo, source="default", **opts):
"""pull changes from the specified source"""
source = ui.expandpath(source)
-
ui.status('pulling from %s\n' % (source))
other = hg.repository(ui, source)
- fetch = repo.findincoming(other)
- if not fetch:
- ui.status("no changes found\n")
- return
-
- cg = other.changegroup(fetch)
- r = repo.addchangegroup(cg)
- if cg and not r:
+ r = repo.pull(other)
+ if not r:
if opts['update']:
return update(ui, repo)
else: