##// END OF EJS Templates
Cleanups for repo.pull...
Matt Mackall -
r625:978011cf default
parent child Browse files
Show More
@@ -331,14 +331,15 b' def clone(ui, source, dest = None, **opt'
331
331
332 class dircleanup:
332 class dircleanup:
333 def __init__(self, dir):
333 def __init__(self, dir):
334 import shutil
335 self.rmtree = shutil.rmtree
334 self.dir = dir
336 self.dir = dir
335 os.mkdir(dir)
337 os.mkdir(dir)
336 def close(self):
338 def close(self):
337 self.dir = None
339 self.dir = None
338 def __del__(self):
340 def __del__(self):
339 if self.dir:
341 if self.dir:
340 import shutil
342 self.rmtree(self.dir, True)
341 shutil.rmtree(self.dir, True)
342
343
343 d = dircleanup(dest)
344 d = dircleanup(dest)
344
345
@@ -346,6 +347,7 b' def clone(ui, source, dest = None, **opt'
346 abspath = source
347 abspath = source
347 if not (source.startswith("http://") or
348 if not (source.startswith("http://") or
348 source.startswith("hg://") or
349 source.startswith("hg://") or
350 source.startswith("ssh://") or
349 source.startswith("old-http://")):
351 source.startswith("old-http://")):
350 abspath = os.path.abspath(source)
352 abspath = os.path.abspath(source)
351 d1 = os.stat(dest).st_dev
353 d1 = os.stat(dest).st_dev
@@ -364,10 +366,7 b' def clone(ui, source, dest = None, **opt'
364 else:
366 else:
365 repo = hg.repository(ui, dest, create=1)
367 repo = hg.repository(ui, dest, create=1)
366 other = hg.repository(ui, source)
368 other = hg.repository(ui, source)
367 fetch = repo.findincoming(other)
369 repo.pull(other)
368 if fetch:
369 cg = other.changegroup(fetch)
370 repo.addchangegroup(cg)
371
370
372 f = repo.opener("hgrc", "w")
371 f = repo.opener("hgrc", "w")
373 f.write("[paths]\n")
372 f.write("[paths]\n")
@@ -694,18 +693,11 b' def parents(ui, repo, node = None):'
694 def pull(ui, repo, source="default", **opts):
693 def pull(ui, repo, source="default", **opts):
695 """pull changes from the specified source"""
694 """pull changes from the specified source"""
696 source = ui.expandpath(source)
695 source = ui.expandpath(source)
697
698 ui.status('pulling from %s\n' % (source))
696 ui.status('pulling from %s\n' % (source))
699
697
700 other = hg.repository(ui, source)
698 other = hg.repository(ui, source)
701 fetch = repo.findincoming(other)
699 r = repo.pull(other)
702 if not fetch:
700 if not r:
703 ui.status("no changes found\n")
704 return
705
706 cg = other.changegroup(fetch)
707 r = repo.addchangegroup(cg)
708 if cg and not r:
709 if opts['update']:
701 if opts['update']:
710 return update(ui, repo)
702 return update(ui, repo)
711 else:
703 else:
General Comments 0
You need to be logged in to leave comments. Login now