Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 634:da5378d39269
Add a repo method to report repo device
This is used to establish whether repos are on the same device for
hard linking. Remote repos all return -1.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 06 Jul 2005 22:14:10 -0800 |
parents | 8b8f710bb658 |
children | 85e2209d401c |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Jul 06 22:11:54 2005 -0800 +++ b/mercurial/commands.py Wed Jul 06 22:14:10 2005 -0800 @@ -362,8 +362,6 @@ def clone(ui, source, dest = None, **opts): """make a copy of an existing repository""" - source = ui.expandpath(source) - if dest is None: dest = os.path.basename(os.path.normpath(source)) @@ -384,20 +382,13 @@ self.rmtree(self.dir, True) d = dircleanup(dest) - link = 0 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 - d2 = os.stat(source).st_dev - if d1 == d2: link = 1 + source = ui.expandpath(source) + other = hg.repository(ui, source) - if link: - ui.note("copying by hardlink\n") + if other.dev() != -1 and os.stat(dest).st_dev == other.dev(): + ui.status("cloning by hardlink\n") util.system("cp -al '%s'/.hg '%s'/.hg" % (source, dest)) try: os.remove(os.path.join(dest, ".hg", "dirstate")) @@ -407,7 +398,6 @@ else: repo = hg.repository(ui, dest, create=1) - other = hg.repository(ui, source) repo.pull(other) f = repo.opener("hgrc", "w")