Show More
@@ -38,6 +38,7 b' from . import (' | |||||
38 | narrowspec, |
|
38 | narrowspec, | |
39 | node, |
|
39 | node, | |
40 | phases, |
|
40 | phases, | |
|
41 | pycompat, | |||
41 | repository as repositorymod, |
|
42 | repository as repositorymod, | |
42 | scmutil, |
|
43 | scmutil, | |
43 | sshpeer, |
|
44 | sshpeer, | |
@@ -57,7 +58,15 b" sharedbookmarks = 'bookmarks'" | |||||
57 |
|
58 | |||
58 | def _local(path): |
|
59 | def _local(path): | |
59 | path = util.expandpath(util.urllocalpath(path)) |
|
60 | path = util.expandpath(util.urllocalpath(path)) | |
60 | return (os.path.isfile(path) and bundlerepo or localrepo) |
|
61 | ||
|
62 | try: | |||
|
63 | isfile = os.path.isfile(path) | |||
|
64 | # Python 2 raises TypeError, Python 3 ValueError. | |||
|
65 | except (TypeError, ValueError) as e: | |||
|
66 | raise error.Abort(_('invalid path %s: %s') % ( | |||
|
67 | path, pycompat.bytestr(e))) | |||
|
68 | ||||
|
69 | return isfile and bundlerepo or localrepo | |||
61 |
|
70 | |||
62 | def addbranchrevs(lrepo, other, branches, revs): |
|
71 | def addbranchrevs(lrepo, other, branches, revs): | |
63 | peer = other.peer() # a courtesy to callers using a localrepo for other |
|
72 | peer = other.peer() # a courtesy to callers using a localrepo for other |
@@ -2051,7 +2051,11 b' class path(object):' | |||||
2051 | This is its own function so that extensions can change the definition of |
|
2051 | This is its own function so that extensions can change the definition of | |
2052 | 'valid' in this case (like when pulling from a git repo into a hg |
|
2052 | 'valid' in this case (like when pulling from a git repo into a hg | |
2053 | one).""" |
|
2053 | one).""" | |
2054 | return os.path.isdir(os.path.join(path, '.hg')) |
|
2054 | try: | |
|
2055 | return os.path.isdir(os.path.join(path, '.hg')) | |||
|
2056 | # Python 2 may return TypeError. Python 3, ValueError. | |||
|
2057 | except (TypeError, ValueError): | |||
|
2058 | return False | |||
2055 |
|
2059 | |||
2056 | @property |
|
2060 | @property | |
2057 | def suboptions(self): |
|
2061 | def suboptions(self): |
@@ -107,6 +107,6 b'' | |||||
107 | # Test that warning is displayed when the repo path is malformed |
|
107 | # Test that warning is displayed when the repo path is malformed | |
108 |
|
108 | |||
109 | $ printf "asdas\0das" >> $CACHEDIR/repos |
|
109 | $ printf "asdas\0das" >> $CACHEDIR/repos | |
110 | $ hg gc 2>&1 | head -n2 |
|
110 | $ hg gc | |
111 | warning: malformed path: * (glob) |
|
111 | abort: invalid path asdas\x00da: stat() argument 1 must be encoded string without null bytes, not str (esc) | |
112 | Traceback (most recent call last): |
|
112 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now