[PATCH] Proof of concept: Use paths instead of the suggested Scheme extension
Mads Kiilerich
mads at kiilerich.com
Fri Mar 13 09:01:11 CDT 2009
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1236952811 -3600
# Node ID 78c5cf749e68fc5208b6b7a1c1d1c9079adf3b94
# Parent 2444285ec33870de0e3fcaa7c9cfda63649c3a5e
Proof of concept: Use paths instead of the suggested Scheme extension
Usage example:
hg -v --config paths.selenic=http://www.selenic.com/repo/ clone selenic/hello /tmp/hello
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -363,10 +363,14 @@
if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')):
return loc
- path = self.config("paths", loc)
- if not path and default is not None:
- path = self.config("paths", default)
- return path or loc
+ pos = len(loc)
+ while pos > 0:
+ path = self.config("paths", loc[:pos])
+ if path:
+ return path + '/' + loc[pos + 1:]
+ pos = loc.rfind('/', 0, pos)
+
+ return self.config("paths", default) or loc
def pushbuffer(self):
self.buffers.append([])
More information about the Mercurial
mailing list