Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

mercurial.url.netlocsplit was removed

Changeset 92a8439948cf

Parent e4f4755ba8d9

by Adrian Buehlmann

Changes to 2 files · Browse files at 92a8439948cf Showing diff from parent e4f4755ba8d9 Diff from another changeset...

 
43
44
45
46
 
47
48
49
 
43
44
45
 
46
47
48
49
@@ -43,7 +43,7 @@
  elif path.startswith('http://') or path.startswith('https://'):   snpaqf = urlparse.urlparse(path)   scheme, netloc, folder, params, query, fragment = snpaqf - host, port, user, passwd = url.netlocsplit(netloc) + host, port, user, passwd = hglib.netlocsplit(netloc)   if folder.startswith('/'):   folder = folder[1:]   else:
 
9
10
11
 
12
13
14
 
640
641
642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
10
11
12
13
14
15
 
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
@@ -9,6 +9,7 @@
 import sys  import shlex  import time +import urllib    from mercurial import ui, util, extensions, match, bundlerepo, cmdutil  from mercurial import dispatch, encoding, templatefilters, filemerge, error @@ -640,3 +641,24 @@
  else:   return os.path.join(wsub, wsubsub), wfileinsub, sctx   return None, wfile, ctx + +def netlocsplit(netloc): + '''split [user[:passwd]@]host[:port] into 4-tuple.''' + + a = netloc.find('@') + if a == -1: + user, passwd = None, None + else: + userpass, netloc = netloc[:a], netloc[a + 1:] + c = userpass.find(':') + if c == -1: + user, passwd = urllib.unquote(userpass), None + else: + user = urllib.unquote(userpass[:c]) + passwd = urllib.unquote(userpass[c + 1:]) + c = netloc.find(':') + if c == -1: + host, port = netloc, None + else: + host, port = netloc[:c], netloc[c + 1:] + return host, port, user, passwd