[PATCH 2 of 6] fixing-import-cycle: _openstore moved from basestore to localstore
Pulkit Goyal
7895pulkit at gmail.com
Sun Apr 3 18:03:01 EDT 2016
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1459720306 -19800
# Mon Apr 04 03:21:46 2016 +0530
# Node ID 6526716e07f80ed1098c1866395f3be36dd21047
# Parent 68ebd8b8579b03fc98d8e119d82985a3e91862b6
fixing-import-cycle: _openstore moved from basestore to localstore
diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py
+++ b/hgext/largefiles/basestore.py
@@ -159,54 +159,3 @@
Returns _true_ if it is a standin and any problems are found!
'''
raise NotImplementedError('abstract method')
-
-_scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')
-
-# During clone this function is passed the src's ui object
-# but it needs the dest's ui object so it can read out of
-# the config file. Use repo.ui instead.
-def _openstore(repo, remote=None, put=False):
- ui = repo.ui
-
- if not remote:
- lfpullsource = getattr(repo, 'lfpullsource', None)
- if lfpullsource:
- path = ui.expandpath(lfpullsource)
- elif put:
- path = ui.expandpath('default-push', 'default')
- else:
- path = ui.expandpath('default')
-
- # ui.expandpath() leaves 'default-push' and 'default' alone if
- # they cannot be expanded: fallback to the empty string,
- # meaning the current directory.
- if path == 'default-push' or path == 'default':
- path = ''
- remote = repo
- else:
- path, _branches = hg.parseurl(path)
- remote = hg.peer(repo, {}, path)
-
- # The path could be a scheme so use Mercurial's normal functionality
- # to resolve the scheme to a repository and use its path
- path = util.safehasattr(remote, 'url') and remote.url() or remote.path
-
- match = _scheme_re.match(path)
- if not match: # regular filesystem path
- scheme = 'file'
- else:
- scheme = match.group(1)
-
- try:
- storeproviders = _storeprovider[scheme]
- except KeyError:
- raise error.Abort(_('unsupported URL scheme %r') % scheme)
-
- for classobj in storeproviders:
- try:
- return classobj(ui, repo, remote)
- except lfutil.storeprotonotcapable:
- pass
-
- raise error.Abort(_('%s does not appear to be a largefile store') %
- util.hidepassword(path))
diff --git a/hgext/largefiles/localstore.py b/hgext/largefiles/localstore.py
--- a/hgext/largefiles/localstore.py
+++ b/hgext/largefiles/localstore.py
@@ -78,3 +78,53 @@
'ssh': [wirestore.wirestore],
}
+_scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')
+
+# During clone this function is passed the src's ui object
+# but it needs the dest's ui object so it can read out of
+# the config file. Use repo.ui instead.
+def _openstore(repo, remote=None, put=False):
+ ui = repo.ui
+
+ if not remote:
+ lfpullsource = getattr(repo, 'lfpullsource', None)
+ if lfpullsource:
+ path = ui.expandpath(lfpullsource)
+ elif put:
+ path = ui.expandpath('default-push', 'default')
+ else:
+ path = ui.expandpath('default')
+
+ # ui.expandpath() leaves 'default-push' and 'default' alone if
+ # they cannot be expanded: fallback to the empty string,
+ # meaning the current directory.
+ if path == 'default-push' or path == 'default':
+ path = ''
+ remote = repo
+ else:
+ path, _branches = hg.parseurl(path)
+ remote = hg.peer(repo, {}, path)
+
+ # The path could be a scheme so use Mercurial's normal functionality
+ # to resolve the scheme to a repository and use its path
+ path = util.safehasattr(remote, 'url') and remote.url() or remote.path
+
+ match = _scheme_re.match(path)
+ if not match: # regular filesystem path
+ scheme = 'file'
+ else:
+ scheme = match.group(1)
+
+ try:
+ storeproviders = _storeprovider[scheme]
+ except KeyError:
+ raise error.Abort(_('unsupported URL scheme %r') % scheme)
+
+ for classobj in storeproviders:
+ try:
+ return classobj(ui, repo, remote)
+ except lfutil.storeprotonotcapable:
+ pass
+
+ raise error.Abort(_('%s does not appear to be a largefile store') %
+ util.hidepassword(path))
More information about the Mercurial-devel
mailing list