zeroconf: override default destination folder on clone
authorHenrik Stuart <hg@hstuart.dk>
Sat, 06 Feb 2010 17:31:49 +0100
changeset 10342 579aae5aa549
parent 10341 c203878e58ba
child 10343 b8e3aeb7542c
zeroconf: override default destination folder on clone
hgext/zeroconf/__init__.py
--- a/hgext/zeroconf/__init__.py	Sat Feb 06 17:37:52 2010 +0100
+++ b/hgext/zeroconf/__init__.py	Sat Feb 06 17:31:49 2010 +0100
@@ -24,7 +24,7 @@
 '''
 
 import Zeroconf, socket, time, os
-from mercurial import ui
+from mercurial import ui, hg, encoding
 from mercurial import extensions
 from mercurial.hgweb import hgweb_mod
 from mercurial.hgweb import hgwebdir_mod
@@ -156,7 +156,14 @@
         repos += getzcpaths()
     return repos
 
+def defaultdest(orig, source):
+    for name, path in getzcpaths():
+        if path == source:
+            return name.encode(encoding.encoding)
+    return orig(source)
+
 extensions.wrapfunction(ui.ui, 'config', config)
 extensions.wrapfunction(ui.ui, 'configitems', configitems)
+extensions.wrapfunction(hg, 'defaultdest', defaultdest)
 hgweb_mod.hgweb = hgwebzc
 hgwebdir_mod.hgwebdir = hgwebdirzc