[PATCH 1 of 3] Add cancopy() method to repo classes
John Mulligan
phlogistonjohn at asynchrono.us
Sat Mar 15 16:34:51 UTC 2008
# HG changeset patch
# User John Mulligan <phlogistonjohn at asynchrono.us>
# Date 1205595829 14400
# Node ID ee80fcb9d96fd9aa9cb2c1e7a0031da4eaccf267
# Parent d036ea7111405d03775cf50377bfeedf027a2ee9
Add cancopy() method to repo classes
cancopy() returns true if direct copy can be used during clone
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -224,6 +224,9 @@
def dev(self):
return -1
+ def cancopy(self):
+ return False
+
def file(self, f):
if not self.bundlefilespos:
self.bundlefile.seek(self.filestart)
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -148,7 +148,7 @@
abspath = origsource
copy = False
- if src_repo.local() and islocal(dest):
+ if src_repo.cancopy() and islocal(dest):
abspath = os.path.abspath(util.drop_scheme('file', origsource))
copy = not pull and not rev
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -454,6 +454,9 @@
return os.lstat(self.path).st_dev
def local(self):
+ return True
+
+ def cancopy(self):
return True
def join(self, f):
diff --git a/mercurial/remoterepo.py b/mercurial/remoterepo.py
--- a/mercurial/remoterepo.py
+++ b/mercurial/remoterepo.py
@@ -14,6 +14,9 @@
def local(self):
return False
+ def cancopy(self):
+ return False
+
class remotelock(object):
def __init__(self, repo):
self.repo = repo
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -80,6 +80,9 @@
def local(self):
return False
+ def cancopy(self):
+ return False
+
def instance(ui, path, create):
if create:
raise util.Abort(_('cannot create new static-http repository'))
More information about the Mercurial-devel
mailing list