the patch in hglib.py
On Tue, Oct 27, 2009 at 7:02 PM, Steve Borho <st...@borho.org> wrote:
> On Tue, Oct 27, 2009 at 1:30 PM, Diego Oliveira <loki...@gmail.com> wrote:
> > Follows attached the patch, it unify in a method the resolution of
> encoded
> > URLs and
> > is use widely (history, sync)
>
> The idea is sound, but the function should go in hglib.py rather than
> paths.py, and the summary needs a prefix. 'hglib: ' would be a fine
> prefix.
>
> Thanks.
>
> --
> Steve Borho
>
--
Att.
Diego de Oliveira
System Architect
di...@diegooliveira.com
www.diegooliveira.com
# HG changeset patch
# User Diego Oliveira <di...@diegooliveira.com>
# Date 1256731947 7200
# Branch stable
# Node ID 2ce7d89d1a68816ce2d44843b4256c07b6630812
# Parent 228d2af5b440c6bcb811024c73dcfe81c32ae27d
hglib: add logic to validate the sync path
unification of the sync path validation logic used in history.py and synch.py
diff -r 228d2af5b440 -r 2ce7d89d1a68 tortoisehg/hgtk/history.py
--- a/tortoisehg/hgtk/history.py Tue Oct 27 22:24:39 2009 -0500
+++ b/tortoisehg/hgtk/history.py Wed Oct 28 10:12:27 2009 -0200
@@ -1196,12 +1196,8 @@
atexit.register(cleanup)
bfile = path
+ path = hglib.validate_synch_path(path, self.repo)
- for alias, path_aux in self.repo.ui.configitems('paths'):
- if path == alias:
- path = path_aux
- elif path == url.hidepassword(path_aux):
- path = path_aux
for badchar in (':', '*', '\\', '?', '#'):
bfile = bfile.replace(badchar, '')
@@ -1330,7 +1326,7 @@
q = Queue.Queue()
cmd = [q, 'outgoing', '--quiet', '--template', '{node}\n']
cmd += self.get_proxy_args()
- cmd += [path]
+ cmd += [hglib.validate_synch_path(path, self.repo)]
def threadfunc(q, *args):
try:
diff -r 228d2af5b440 -r 2ce7d89d1a68 tortoisehg/hgtk/synch.py
--- a/tortoisehg/hgtk/synch.py Tue Oct 27 22:24:39 2009 -0500
+++ b/tortoisehg/hgtk/synch.py Wed Oct 28 10:12:27 2009 -0200
@@ -544,11 +544,7 @@
use_proxy = self.use_proxy.get_active()
text_entry = self.pathbox.get_child()
remote_path = hglib.fromutf(text_entry.get_text()).strip()
- for alias, path in self.paths:
- if remote_path == alias:
- remote_path = path
- elif remote_path == url.hidepassword(path):
- remote_path = path
+ remote_path = hglib.validate_synch_path(remote_path, self.repo)
cmdline = cmd[:]
cmdline += ['--verbose']
diff -r 228d2af5b440 -r 2ce7d89d1a68 tortoisehg/util/hglib.py
--- a/tortoisehg/util/hglib.py Tue Oct 27 22:24:39 2009 -0500
+++ b/tortoisehg/util/hglib.py Wed Oct 28 10:12:27 2009 -0200
@@ -4,6 +4,7 @@
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
+from mercurial.url import url
import os
import sys
@@ -219,3 +220,17 @@
if not author:
author = util.shortuser(user)
return author
+
+def validate_synch_path(path, repo):
+ '''
+ Validate the path that must be used to sync operations (pull,
+ push, outgoing and incoming)
+ '''
+ return_path = path
+ for alias, path_aux in repo.ui.configitems('paths'):
+ if path == alias:
+ return_path = path_aux
+ elif path == url.hidepassword(path_aux):
+ return_path = path_aux
+ return return_path
+
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop