Show More
@@ -33,12 +33,16 b' sink_converters = [' | |||||
33 | ] |
|
33 | ] | |
34 |
|
34 | |||
35 | def convertsource(ui, path, type, rev): |
|
35 | def convertsource(ui, path, type, rev): | |
|
36 | exceptions = [] | |||
36 | for name, source in source_converters: |
|
37 | for name, source in source_converters: | |
37 | try: |
|
38 | try: | |
38 | if not type or name == type: |
|
39 | if not type or name == type: | |
39 | return source(ui, path, rev) |
|
40 | return source(ui, path, rev) | |
40 | except NoRepo, inst: |
|
41 | except NoRepo, inst: | |
41 | ui.note(_("convert: %s\n") % inst) |
|
42 | exceptions.append(inst) | |
|
43 | if not ui.quiet: | |||
|
44 | for inst in exceptions: | |||
|
45 | ui.write(_("%s\n") % inst) | |||
42 | raise util.Abort('%s: unknown repository type' % path) |
|
46 | raise util.Abort('%s: unknown repository type' % path) | |
43 |
|
47 | |||
44 | def convertsink(ui, path, type): |
|
48 | def convertsink(ui, path, type): |
@@ -11,7 +11,7 b' class convert_cvs(converter_source):' | |||||
11 |
|
11 | |||
12 | cvs = os.path.join(path, "CVS") |
|
12 | cvs = os.path.join(path, "CVS") | |
13 | if not os.path.exists(cvs): |
|
13 | if not os.path.exists(cvs): | |
14 |
raise NoRepo(" |
|
14 | raise NoRepo("%s does not look like a CVS checkout" % path) | |
15 |
|
15 | |||
16 | for tool in ('cvsps', 'cvs'): |
|
16 | for tool in ('cvsps', 'cvs'): | |
17 | checktool(tool) |
|
17 | checktool(tool) |
@@ -22,14 +22,19 b' class darcs_source(converter_source, com' | |||||
22 | converter_source.__init__(self, ui, path, rev=rev) |
|
22 | converter_source.__init__(self, ui, path, rev=rev) | |
23 | commandline.__init__(self, ui, 'darcs') |
|
23 | commandline.__init__(self, ui, 'darcs') | |
24 |
|
24 | |||
25 | if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): |
|
25 | # check for _darcs, ElementTree, _darcs/inventory so that we can | |
26 | raise NoRepo("couldn't open darcs repo %s" % path) |
|
26 | # easily skip test-convert-darcs if ElementTree is not around | |
|
27 | if not os.path.exists(os.path.join(path, '_darcs')): | |||
|
28 | raise NoRepo("%s does not look like a darcs repo" % path) | |||
27 |
|
29 | |||
28 | checktool('darcs') |
|
30 | checktool('darcs') | |
29 |
|
31 | |||
30 | if ElementTree is None: |
|
32 | if ElementTree is None: | |
31 | raise util.Abort(_("Python ElementTree module is not available")) |
|
33 | raise util.Abort(_("Python ElementTree module is not available")) | |
32 |
|
34 | |||
|
35 | if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): | |||
|
36 | raise NoRepo("%s does not look like a darcs repo" % path) | |||
|
37 | ||||
33 | self.path = os.path.realpath(path) |
|
38 | self.path = os.path.realpath(path) | |
34 |
|
39 | |||
35 | self.lastrev = None |
|
40 | self.lastrev = None |
@@ -30,7 +30,7 b' class convert_git(converter_source):' | |||||
30 | if os.path.isdir(path + "/.git"): |
|
30 | if os.path.isdir(path + "/.git"): | |
31 | path += "/.git" |
|
31 | path += "/.git" | |
32 | if not os.path.exists(path + "/objects"): |
|
32 | if not os.path.exists(path + "/objects"): | |
33 |
raise NoRepo(" |
|
33 | raise NoRepo("%s does not look like a Git repo" % path) | |
34 |
|
34 | |||
35 | checktool('git-rev-parse', 'git') |
|
35 | checktool('git-rev-parse', 'git') | |
36 |
|
36 |
@@ -187,10 +187,11 b' class mercurial_source(converter_source)' | |||||
187 | self.repo = hg.repository(self.ui, path) |
|
187 | self.repo = hg.repository(self.ui, path) | |
188 | # try to provoke an exception if this isn't really a hg |
|
188 | # try to provoke an exception if this isn't really a hg | |
189 | # repo, but some other bogus compatible-looking url |
|
189 | # repo, but some other bogus compatible-looking url | |
190 |
self.repo. |
|
190 | if not self.repo.local(): | |
|
191 | raise hg.RepoError() | |||
191 | except hg.RepoError: |
|
192 | except hg.RepoError: | |
192 | ui.print_exc() |
|
193 | ui.print_exc() | |
193 |
raise NoRepo(" |
|
194 | raise NoRepo("%s is not a local Mercurial repo" % path) | |
194 | self.lastrev = None |
|
195 | self.lastrev = None | |
195 | self.lastctx = None |
|
196 | self.lastctx = None | |
196 | self._changescache = None |
|
197 | self._changescache = None |
@@ -107,7 +107,7 b' class svn_source(converter_source):' | |||||
107 | try: |
|
107 | try: | |
108 | SubversionException |
|
108 | SubversionException | |
109 | except NameError: |
|
109 | except NameError: | |
110 |
raise NoRepo(' |
|
110 | raise NoRepo('Subversion python bindings could not be loaded') | |
111 |
|
111 | |||
112 | self.encoding = locale.getpreferredencoding() |
|
112 | self.encoding = locale.getpreferredencoding() | |
113 | self.lastrevs = {} |
|
113 | self.lastrevs = {} | |
@@ -136,7 +136,7 b' class svn_source(converter_source):' | |||||
136 | self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) |
|
136 | self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) | |
137 | except SubversionException, e: |
|
137 | except SubversionException, e: | |
138 | ui.print_exc() |
|
138 | ui.print_exc() | |
139 |
raise NoRepo(" |
|
139 | raise NoRepo("%s does not look like a Subversion repo" % self.url) | |
140 |
|
140 | |||
141 | if rev: |
|
141 | if rev: | |
142 | try: |
|
142 | try: |
@@ -456,6 +456,7 b' class queue:' | |||||
456 | raise |
|
456 | raise | |
457 | finally: |
|
457 | finally: | |
458 | del tr, lock, wlock |
|
458 | del tr, lock, wlock | |
|
459 | self.removeundo(repo) | |||
459 |
|
460 | |||
460 | def _apply(self, repo, series, list=False, update_status=True, |
|
461 | def _apply(self, repo, series, list=False, update_status=True, | |
461 | strict=False, patchdir=None, merge=None, all_files={}): |
|
462 | strict=False, patchdir=None, merge=None, all_files={}): | |
@@ -527,7 +528,6 b' class queue:' | |||||
527 | self.ui.warn("fuzz found when applying patch, stopping\n") |
|
528 | self.ui.warn("fuzz found when applying patch, stopping\n") | |
528 | err = 1 |
|
529 | err = 1 | |
529 | break |
|
530 | break | |
530 | self.removeundo(repo) |
|
|||
531 | return (err, n) |
|
531 | return (err, n) | |
532 |
|
532 | |||
533 | def delete(self, repo, patches, opts): |
|
533 | def delete(self, repo, patches, opts): | |
@@ -654,6 +654,9 b' class queue:' | |||||
654 |
|
654 | |||
655 | self.removeundo(repo) |
|
655 | self.removeundo(repo) | |
656 | repair.strip(self.ui, repo, rev, backup) |
|
656 | repair.strip(self.ui, repo, rev, backup) | |
|
657 | # strip may have unbundled a set of backed up revisions after | |||
|
658 | # the actual strip | |||
|
659 | self.removeundo(repo) | |||
657 | finally: |
|
660 | finally: | |
658 | del lock, wlock |
|
661 | del lock, wlock | |
659 |
|
662 |
@@ -49,6 +49,9 b' def dopurge(ui, repo, dirs=None, act=Tru' | |||||
49 | else: |
|
49 | else: | |
50 | ui.write('%s%s' % (name, eol)) |
|
50 | ui.write('%s%s' % (name, eol)) | |
51 |
|
51 | |||
|
52 | if not force: | |||
|
53 | _check_fs(ui, repo) | |||
|
54 | ||||
52 | directories = [] |
|
55 | directories = [] | |
53 | files = [] |
|
56 | files = [] | |
54 | missing = [] |
|
57 | missing = [] | |
@@ -63,8 +66,6 b' def dopurge(ui, repo, dirs=None, act=Tru' | |||||
63 | elif src == 'f' and f not in repo.dirstate: |
|
66 | elif src == 'f' and f not in repo.dirstate: | |
64 | files.append(f) |
|
67 | files.append(f) | |
65 |
|
68 | |||
66 | _check_missing(ui, repo, missing, force) |
|
|||
67 |
|
||||
68 | directories.sort() |
|
69 | directories.sort() | |
69 |
|
70 | |||
70 | for f in files: |
|
71 | for f in files: | |
@@ -77,7 +78,7 b' def dopurge(ui, repo, dirs=None, act=Tru' | |||||
77 | ui.note(_('Removing directory %s\n') % f) |
|
78 | ui.note(_('Removing directory %s\n') % f) | |
78 | remove(os.rmdir, f) |
|
79 | remove(os.rmdir, f) | |
79 |
|
80 | |||
80 |
def _check_ |
|
81 | def _check_fs(ui, repo): | |
81 | """Abort if there is the chance of having problems with name-mangling fs |
|
82 | """Abort if there is the chance of having problems with name-mangling fs | |
82 |
|
83 | |||
83 | In a name mangling filesystem (e.g. a case insensitive one) |
|
84 | In a name mangling filesystem (e.g. a case insensitive one) | |
@@ -85,34 +86,18 b' def _check_missing(ui, repo, missing, fo' | |||||
85 | stored in the dirstate. This already confuses the status and |
|
86 | stored in the dirstate. This already confuses the status and | |
86 | add commands, but with purge this may cause data loss. |
|
87 | add commands, but with purge this may cause data loss. | |
87 |
|
88 | |||
88 |
To prevent this, |
|
89 | To prevent this, this function will abort if there are uncommitted | |
89 | files. The force option will let the user skip the check if he |
|
90 | changes. | |
90 | knows it is safe. |
|
91 | """ | |
91 |
|
||||
92 | Even with the force option this function will check if any of the |
|
|||
93 | missing files is still available in the working dir: if so there |
|
|||
94 | may be some problem with the underlying filesystem, so it |
|
|||
95 | aborts unconditionally.""" |
|
|||
96 |
|
||||
97 | found = [f for f in missing if util.lexists(repo.wjoin(f))] |
|
|||
98 |
|
92 | |||
99 | if found: |
|
93 | # We can't use (files, match) to do a partial walk here - we wouldn't | |
100 | if not ui.quiet: |
|
94 | # notice a modified README file if the user ran "hg purge readme" | |
101 | ui.warn(_("The following tracked files weren't listed by the " |
|
95 | modified, added, removed, deleted = repo.status()[:4] | |
102 | "filesystem, but could still be found:\n")) |
|
96 | if modified or added or removed or deleted: | |
103 | for f in found: |
|
97 | if not util.checkfolding(repo.path) and not ui.quiet: | |
104 | ui.warn("%s\n" % f) |
|
98 | ui.warn(_("Purging on name mangling filesystems is not " | |
105 | if util.checkfolding(repo.path): |
|
99 | "fully supported.\n")) | |
106 | ui.warn(_("This is probably due to a case-insensitive " |
|
100 | raise util.Abort(_("outstanding uncommitted changes")) | |
107 | "filesystem\n")) |
|
|||
108 | raise util.Abort(_("purging on name mangling filesystems is not " |
|
|||
109 | "yet fully supported")) |
|
|||
110 |
|
||||
111 | if missing and not force: |
|
|||
112 | raise util.Abort(_("there are missing files in the working dir and " |
|
|||
113 | "purge still has problems with them due to name " |
|
|||
114 | "mangling filesystems. " |
|
|||
115 | "Use --force if you know what you are doing")) |
|
|||
116 |
|
101 | |||
117 |
|
102 | |||
118 | def purge(ui, repo, *dirs, **opts): |
|
103 | def purge(ui, repo, *dirs, **opts): | |
@@ -158,7 +143,7 b' cmdtable = {' | |||||
158 | (purge, |
|
143 | (purge, | |
159 | [('a', 'abort-on-err', None, _('abort if an error occurs')), |
|
144 | [('a', 'abort-on-err', None, _('abort if an error occurs')), | |
160 | ('', 'all', None, _('purge ignored files too')), |
|
145 | ('', 'all', None, _('purge ignored files too')), | |
161 |
('f', 'force', None, _('purge even when |
|
146 | ('f', 'force', None, _('purge even when there are uncommitted changes')), | |
162 | ('p', 'print', None, _('print the file names instead of deleting them')), |
|
147 | ('p', 'print', None, _('print the file names instead of deleting them')), | |
163 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs' |
|
148 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs' | |
164 | ' (implies -p)')), |
|
149 | ' (implies -p)')), |
@@ -1652,7 +1652,7 b' def incoming(ui, repo, source="default",' | |||||
1652 | cmdutil.setremoteconfig(ui, opts) |
|
1652 | cmdutil.setremoteconfig(ui, opts) | |
1653 |
|
1653 | |||
1654 | other = hg.repository(ui, source) |
|
1654 | other = hg.repository(ui, source) | |
1655 | ui.status(_('comparing with %s\n') % source) |
|
1655 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) | |
1656 | if revs: |
|
1656 | if revs: | |
1657 | revs = [other.lookup(rev) for rev in revs] |
|
1657 | revs = [other.lookup(rev) for rev in revs] | |
1658 | incoming = repo.findincoming(other, heads=revs, force=opts["force"]) |
|
1658 | incoming = repo.findincoming(other, heads=revs, force=opts["force"]) | |
@@ -1962,7 +1962,7 b' def outgoing(ui, repo, dest=None, **opts' | |||||
1962 | revs = [repo.lookup(rev) for rev in revs] |
|
1962 | revs = [repo.lookup(rev) for rev in revs] | |
1963 |
|
1963 | |||
1964 | other = hg.repository(ui, dest) |
|
1964 | other = hg.repository(ui, dest) | |
1965 | ui.status(_('comparing with %s\n') % dest) |
|
1965 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) | |
1966 | o = repo.findoutgoing(other, force=opts['force']) |
|
1966 | o = repo.findoutgoing(other, force=opts['force']) | |
1967 | if not o: |
|
1967 | if not o: | |
1968 | ui.status(_("no changes found\n")) |
|
1968 | ui.status(_("no changes found\n")) | |
@@ -2095,7 +2095,7 b' def pull(ui, repo, source="default", **o' | |||||
2095 | cmdutil.setremoteconfig(ui, opts) |
|
2095 | cmdutil.setremoteconfig(ui, opts) | |
2096 |
|
2096 | |||
2097 | other = hg.repository(ui, source) |
|
2097 | other = hg.repository(ui, source) | |
2098 | ui.status(_('pulling from %s\n') % (source)) |
|
2098 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) | |
2099 | if revs: |
|
2099 | if revs: | |
2100 | try: |
|
2100 | try: | |
2101 | revs = [other.lookup(rev) for rev in revs] |
|
2101 | revs = [other.lookup(rev) for rev in revs] | |
@@ -2142,7 +2142,7 b' def push(ui, repo, dest=None, **opts):' | |||||
2142 | cmdutil.setremoteconfig(ui, opts) |
|
2142 | cmdutil.setremoteconfig(ui, opts) | |
2143 |
|
2143 | |||
2144 | other = hg.repository(ui, dest) |
|
2144 | other = hg.repository(ui, dest) | |
2145 | ui.status('pushing to %s\n' % (dest)) |
|
2145 | ui.status('pushing to %s\n' % util.hidepassword(dest)) | |
2146 | if revs: |
|
2146 | if revs: | |
2147 | revs = [repo.lookup(rev) for rev in revs] |
|
2147 | revs = [repo.lookup(rev) for rev in revs] | |
2148 | r = repo.push(other, opts['force'], revs=revs) |
|
2148 | r = repo.push(other, opts['force'], revs=revs) |
@@ -185,16 +185,15 b' class dirstate(object):' | |||||
185 | dirs[base] += 1 |
|
185 | dirs[base] += 1 | |
186 |
|
186 | |||
187 | def _decpath(self, path): |
|
187 | def _decpath(self, path): | |
188 | if "_dirs" in self.__dict__: |
|
188 | c = path.rfind('/') | |
189 | c = path.rfind('/') |
|
189 | if c >= 0: | |
190 |
|
|
190 | base = path[:c] | |
191 | base = path[:c] |
|
191 | dirs = self._dirs | |
192 |
|
|
192 | if dirs[base] == 1: | |
193 |
|
|
193 | del dirs[base] | |
194 |
|
|
194 | self._decpath(base) | |
195 | self._decpath(base) |
|
195 | else: | |
196 |
|
|
196 | dirs[base] -= 1 | |
197 | dirs[base] -= 1 |
|
|||
198 |
|
197 | |||
199 | def _incpathcheck(self, f): |
|
198 | def _incpathcheck(self, f): | |
200 | if '\r' in f or '\n' in f: |
|
199 | if '\r' in f or '\n' in f: | |
@@ -211,20 +210,29 b' class dirstate(object):' | |||||
211 | (d, f)) |
|
210 | (d, f)) | |
212 | self._incpath(f) |
|
211 | self._incpath(f) | |
213 |
|
212 | |||
214 | def _changepath(self, f, newstate): |
|
213 | def _changepath(self, f, newstate, relaxed=False): | |
215 | # handle upcoming path changes |
|
214 | # handle upcoming path changes | |
216 | oldstate = self[f] |
|
215 | oldstate = self[f] | |
217 | if oldstate not in "?r" and newstate in "?r": |
|
216 | if oldstate not in "?r" and newstate in "?r": | |
218 |
self._ |
|
217 | if "_dirs" in self.__dict__: | |
|
218 | self._decpath(f) | |||
219 | return |
|
219 | return | |
220 | if oldstate in "?r" and newstate not in "?r": |
|
220 | if oldstate in "?r" and newstate not in "?r": | |
|
221 | if relaxed and oldstate == '?': | |||
|
222 | # XXX | |||
|
223 | # in relaxed mode we assume the caller knows | |||
|
224 | # what it is doing, workaround for updating | |||
|
225 | # dir-to-file revisions | |||
|
226 | if "_dirs" in self.__dict__: | |||
|
227 | self._incpath(f) | |||
|
228 | return | |||
221 | self._incpathcheck(f) |
|
229 | self._incpathcheck(f) | |
222 | return |
|
230 | return | |
223 |
|
231 | |||
224 | def normal(self, f): |
|
232 | def normal(self, f): | |
225 | 'mark a file normal and clean' |
|
233 | 'mark a file normal and clean' | |
226 | self._dirty = True |
|
234 | self._dirty = True | |
227 | self._changepath(f, 'n') |
|
235 | self._changepath(f, 'n', True) | |
228 | s = os.lstat(self._join(f)) |
|
236 | s = os.lstat(self._join(f)) | |
229 | self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime, 0) |
|
237 | self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime, 0) | |
230 | if self._copymap.has_key(f): |
|
238 | if self._copymap.has_key(f): | |
@@ -233,7 +241,7 b' class dirstate(object):' | |||||
233 | def normallookup(self, f): |
|
241 | def normallookup(self, f): | |
234 | 'mark a file normal, but possibly dirty' |
|
242 | 'mark a file normal, but possibly dirty' | |
235 | self._dirty = True |
|
243 | self._dirty = True | |
236 | self._changepath(f, 'n') |
|
244 | self._changepath(f, 'n', True) | |
237 | self._map[f] = ('n', 0, -1, -1, 0) |
|
245 | self._map[f] = ('n', 0, -1, -1, 0) | |
238 | if f in self._copymap: |
|
246 | if f in self._copymap: | |
239 | del self._copymap[f] |
|
247 | del self._copymap[f] | |
@@ -241,7 +249,7 b' class dirstate(object):' | |||||
241 | def normaldirty(self, f): |
|
249 | def normaldirty(self, f): | |
242 | 'mark a file normal, but dirty' |
|
250 | 'mark a file normal, but dirty' | |
243 | self._dirty = True |
|
251 | self._dirty = True | |
244 | self._changepath(f, 'n') |
|
252 | self._changepath(f, 'n', True) | |
245 | self._map[f] = ('n', 0, -2, -1, 0) |
|
253 | self._map[f] = ('n', 0, -2, -1, 0) | |
246 | if f in self._copymap: |
|
254 | if f in self._copymap: | |
247 | del self._copymap[f] |
|
255 | del self._copymap[f] | |
@@ -266,7 +274,7 b' class dirstate(object):' | |||||
266 | 'mark a file merged' |
|
274 | 'mark a file merged' | |
267 | self._dirty = True |
|
275 | self._dirty = True | |
268 | s = os.lstat(self._join(f)) |
|
276 | s = os.lstat(self._join(f)) | |
269 | self._changepath(f, 'm') |
|
277 | self._changepath(f, 'm', True) | |
270 | self._map[f] = ('m', s.st_mode, s.st_size, s.st_mtime, 0) |
|
278 | self._map[f] = ('m', s.st_mode, s.st_size, s.st_mtime, 0) | |
271 | if f in self._copymap: |
|
279 | if f in self._copymap: | |
272 | del self._copymap[f] |
|
280 | del self._copymap[f] |
@@ -256,7 +256,11 b' class httprepository(remoterepository):' | |||||
256 | if user: |
|
256 | if user: | |
257 | ui.debug(_('http auth: user %s, password %s\n') % |
|
257 | ui.debug(_('http auth: user %s, password %s\n') % | |
258 | (user, passwd and '*' * len(passwd) or 'not set')) |
|
258 | (user, passwd and '*' * len(passwd) or 'not set')) | |
259 | passmgr.add_password(None, host, user, passwd or '') |
|
259 | netloc = host | |
|
260 | if port: | |||
|
261 | netloc += ':' + port | |||
|
262 | # Python < 2.4.3 uses only the netloc to search for a password | |||
|
263 | passmgr.add_password(None, (self._url, netloc), user, passwd or '') | |||
260 |
|
264 | |||
261 | handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), |
|
265 | handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), | |
262 | httpdigestauthhandler(passmgr))) |
|
266 | httpdigestauthhandler(passmgr))) |
@@ -15,6 +15,7 b' platform-specific details from the core.' | |||||
15 | from i18n import _ |
|
15 | from i18n import _ | |
16 | import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil |
|
16 | import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil | |
17 | import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil |
|
17 | import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil | |
|
18 | import re, urlparse | |||
18 |
|
19 | |||
19 | try: |
|
20 | try: | |
20 | set = set |
|
21 | set = set | |
@@ -1698,3 +1699,33 b' def drop_scheme(scheme, path):' | |||||
1698 | def uirepr(s): |
|
1699 | def uirepr(s): | |
1699 | # Avoid double backslash in Windows path repr() |
|
1700 | # Avoid double backslash in Windows path repr() | |
1700 | return repr(s).replace('\\\\', '\\') |
|
1701 | return repr(s).replace('\\\\', '\\') | |
|
1702 | ||||
|
1703 | def hidepassword(url): | |||
|
1704 | '''replaces the password in the url string by three asterisks (***) | |||
|
1705 | ||||
|
1706 | >>> hidepassword('http://www.example.com/some/path#fragment') | |||
|
1707 | 'http://www.example.com/some/path#fragment' | |||
|
1708 | >>> hidepassword('http://me@www.example.com/some/path#fragment') | |||
|
1709 | 'http://me@www.example.com/some/path#fragment' | |||
|
1710 | >>> hidepassword('http://me:simplepw@www.example.com/path#frag') | |||
|
1711 | 'http://me:***@www.example.com/path#frag' | |||
|
1712 | >>> hidepassword('http://me:complex:pw@www.example.com/path#frag') | |||
|
1713 | 'http://me:***@www.example.com/path#frag' | |||
|
1714 | >>> hidepassword('/path/to/repo') | |||
|
1715 | '/path/to/repo' | |||
|
1716 | >>> hidepassword('relative/path/to/repo') | |||
|
1717 | 'relative/path/to/repo' | |||
|
1718 | >>> hidepassword('c:\\\\path\\\\to\\\\repo') | |||
|
1719 | 'c:\\\\path\\\\to\\\\repo' | |||
|
1720 | >>> hidepassword('c:/path/to/repo') | |||
|
1721 | 'c:/path/to/repo' | |||
|
1722 | >>> hidepassword('bundle://path/to/bundle') | |||
|
1723 | 'bundle://path/to/bundle' | |||
|
1724 | ''' | |||
|
1725 | url_parts = list(urlparse.urlparse(url)) | |||
|
1726 | host_with_pw_pattern = re.compile('^([^:]*):([^@]*)@(.*)$') | |||
|
1727 | if host_with_pw_pattern.match(url_parts[1]): | |||
|
1728 | url_parts[1] = re.sub(host_with_pw_pattern, r'\1:***@\3', | |||
|
1729 | url_parts[1]) | |||
|
1730 | return urlparse.urlunparse(url_parts) | |||
|
1731 |
@@ -266,8 +266,6 b' def run_one(test, skips):' | |||||
266 | def skip(msg): |
|
266 | def skip(msg): | |
267 | if not verbose: |
|
267 | if not verbose: | |
268 | skips.append((test, msg)) |
|
268 | skips.append((test, msg)) | |
269 | sys.stdout.write('s') |
|
|||
270 | sys.stdout.flush() |
|
|||
271 | else: |
|
269 | else: | |
272 | print "\nSkipping %s: %s" % (test, msg) |
|
270 | print "\nSkipping %s: %s" % (test, msg) | |
273 | return None |
|
271 | return None | |
@@ -278,6 +276,11 b' def run_one(test, skips):' | |||||
278 | hgrc = file(HGRCPATH, 'w+') |
|
276 | hgrc = file(HGRCPATH, 'w+') | |
279 | hgrc.write('[ui]\n') |
|
277 | hgrc.write('[ui]\n') | |
280 | hgrc.write('slash = True\n') |
|
278 | hgrc.write('slash = True\n') | |
|
279 | hgrc.write('[defaults]\n') | |||
|
280 | hgrc.write('backout = -d "0 0"\n') | |||
|
281 | hgrc.write('commit = -d "0 0"\n') | |||
|
282 | hgrc.write('debugrawcommit = -d "0 0"\n') | |||
|
283 | hgrc.write('tag = -d "0 0"\n') | |||
281 | hgrc.close() |
|
284 | hgrc.close() | |
282 |
|
285 | |||
283 | err = os.path.join(TESTDIR, test+".err") |
|
286 | err = os.path.join(TESTDIR, test+".err") | |
@@ -352,7 +355,7 b' def run_one(test, skips):' | |||||
352 | ret = diffret |
|
355 | ret = diffret | |
353 |
|
356 | |||
354 | if not verbose: |
|
357 | if not verbose: | |
355 | sys.stdout.write('.') |
|
358 | sys.stdout.write(skipped and 's' or '.') | |
356 | sys.stdout.flush() |
|
359 | sys.stdout.flush() | |
357 |
|
360 | |||
358 | if ret != 0 and not skipped: |
|
361 | if ret != 0 and not skipped: |
@@ -1,6 +1,6 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | cat > $HGRCPATH <<EOF |
|
3 | cat >> $HGRCPATH <<EOF | |
4 | [extensions] |
|
4 | [extensions] | |
5 | alias= |
|
5 | alias= | |
6 |
|
6 |
@@ -15,7 +15,8 b' EOF' | |||||
15 | hg init repo |
|
15 | hg init repo | |
16 | cd repo |
|
16 | cd repo | |
17 | ln -s nothing dangling |
|
17 | ln -s nothing dangling | |
18 | hg ci -qAm 'add symlink' |
|
18 | # avoid tar warnings about old timestamp | |
|
19 | hg ci -d '2000-01-01 00:00:00 +0000' -qAm 'add symlink' | |||
19 |
|
20 | |||
20 | hg archive -t files ../archive |
|
21 | hg archive -t files ../archive | |
21 | hg archive -t tar -p tar ../archive.tar |
|
22 | hg archive -t tar -p tar ../archive.tar |
@@ -9,6 +9,14 b" echo 'hgext.graphlog =' >> $HGRCPATH" | |||||
9 | DARCS_EMAIL='test@example.org'; export DARCS_EMAIL |
|
9 | DARCS_EMAIL='test@example.org'; export DARCS_EMAIL | |
10 | HOME=do_not_use_HOME_darcs; export HOME |
|
10 | HOME=do_not_use_HOME_darcs; export HOME | |
11 |
|
11 | |||
|
12 | # skip if we can't import elementtree | |||
|
13 | mkdir dummy | |||
|
14 | mkdir dummy/_darcs | |||
|
15 | if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then | |||
|
16 | echo 'hghave: missing feature: elementtree module' | |||
|
17 | exit 80 | |||
|
18 | fi | |||
|
19 | ||||
12 | echo % initialize darcs repo |
|
20 | echo % initialize darcs repo | |
13 | mkdir darcs-repo |
|
21 | mkdir darcs-repo | |
14 | cd darcs-repo |
|
22 | cd darcs-repo |
@@ -11,7 +11,7 b' hg cat' | |||||
11 |
|
11 | |||
12 | echo '% [defaults]' |
|
12 | echo '% [defaults]' | |
13 | hg cat a |
|
13 | hg cat a | |
14 | cat > $HGRCPATH <<EOF |
|
14 | cat >> $HGRCPATH <<EOF | |
15 | [defaults] |
|
15 | [defaults] | |
16 | cat = -v |
|
16 | cat = -v | |
17 | EOF |
|
17 | EOF |
@@ -7,3 +7,6 b' doctest.testmod(mercurial.changelog)' | |||||
7 |
|
7 | |||
8 | import mercurial.httprepo |
|
8 | import mercurial.httprepo | |
9 | doctest.testmod(mercurial.httprepo) |
|
9 | doctest.testmod(mercurial.httprepo) | |
|
10 | ||||
|
11 | import mercurial.util | |||
|
12 | doctest.testmod(mercurial.util) |
@@ -47,12 +47,13 b' cd ..' | |||||
47 | hg clone a b |
|
47 | hg clone a b | |
48 |
|
48 | |||
49 | hg bar |
|
49 | hg bar | |
|
50 | echo 'foobar = !' >> $HGRCPATH | |||
50 |
|
51 | |||
51 | echo '% module/__init__.py-style' |
|
52 | echo '% module/__init__.py-style' | |
52 | echo '[extensions]' > $HGRCPATH |
|
|||
53 | echo "barfoo = $barfoopath" >> $HGRCPATH |
|
53 | echo "barfoo = $barfoopath" >> $HGRCPATH | |
54 | cd a |
|
54 | cd a | |
55 | hg foo |
|
55 | hg foo | |
|
56 | echo 'barfoo = !' >> $HGRCPATH | |||
56 |
|
57 | |||
57 | cd .. |
|
58 | cd .. | |
58 | cat > empty.py <<EOF |
|
59 | cat > empty.py <<EOF | |
@@ -61,9 +62,9 b' cat > empty.py <<EOF' | |||||
61 | cmdtable = {} |
|
62 | cmdtable = {} | |
62 | EOF |
|
63 | EOF | |
63 | emptypath=`pwd`/empty.py |
|
64 | emptypath=`pwd`/empty.py | |
64 | echo '[extensions]' > $HGRCPATH |
|
|||
65 | echo "empty = $emptypath" >> $HGRCPATH |
|
65 | echo "empty = $emptypath" >> $HGRCPATH | |
66 | hg help empty |
|
66 | hg help empty | |
|
67 | echo 'empty = !' >> $HGRCPATH | |||
67 |
|
68 | |||
68 | cat > debugextension.py <<EOF |
|
69 | cat > debugextension.py <<EOF | |
69 | '''only debugcommands |
|
70 | '''only debugcommands | |
@@ -75,7 +76,7 b' def debugfoobar(ui, repo, *args, **opts)' | |||||
75 | cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")} |
|
76 | cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")} | |
76 | EOF |
|
77 | EOF | |
77 | debugpath=`pwd`/debugextension.py |
|
78 | debugpath=`pwd`/debugextension.py | |
78 | echo '[extensions]' > $HGRCPATH |
|
|||
79 | echo "debugextension = $debugpath" >> $HGRCPATH |
|
79 | echo "debugextension = $debugpath" >> $HGRCPATH | |
80 | hg help debugextension |
|
80 | hg help debugextension | |
81 | hg --debug help debugextension |
|
81 | hg --debug help debugextension | |
|
82 | echo 'debugextension = !' >> $HGRCPATH |
@@ -80,10 +80,15 b' hg rm --after d/d/d' | |||||
80 |
|
80 | |||
81 | echo % should succeed - shadow removed |
|
81 | echo % should succeed - shadow removed | |
82 | hg add d |
|
82 | hg add d | |
|
83 | hg ci -md | |||
83 |
|
84 | |||
84 |
|
|
85 | echo % update should work at least with clean workdir | |
85 | # |
|
86 | ||
86 | #hg up -r 0 |
|
87 | rm -r a b d | |
87 |
|
|
88 | hg up -r 0 | |
|
89 | hg st --all | |||
|
90 | rm -r a b | |||
|
91 | hg up -r 1 | |||
|
92 | hg st --all | |||
88 |
|
93 | |||
89 | exit 0 |
|
94 | exit 0 |
@@ -40,3 +40,10 b' adding d/d/d' | |||||
40 | abort: directory 'd' already in dirstate |
|
40 | abort: directory 'd' already in dirstate | |
41 | % removing shadow |
|
41 | % removing shadow | |
42 | % should succeed - shadow removed |
|
42 | % should succeed - shadow removed | |
|
43 | % update should work at least with clean workdir | |||
|
44 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
45 | C a | |||
|
46 | C b/b | |||
|
47 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
48 | C a/a | |||
|
49 | C b |
@@ -1,5 +1,12 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
|
3 | checkundo() | |||
|
4 | { | |||
|
5 | if [ -f .hg/store/undo ]; then | |||
|
6 | echo ".hg/store/undo still exists after $1" | |||
|
7 | fi | |||
|
8 | } | |||
|
9 | ||||
3 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
4 | echo "mq=" >> $HGRCPATH |
|
11 | echo "mq=" >> $HGRCPATH | |
5 |
|
12 | |||
@@ -57,6 +64,7 b" echo '% qinit; <stuff>; qinit -c'" | |||||
57 | hg init e |
|
64 | hg init e | |
58 | cd e |
|
65 | cd e | |
59 | hg qnew A |
|
66 | hg qnew A | |
|
67 | checkundo qnew | |||
60 | echo foo > foo |
|
68 | echo foo > foo | |
61 | hg add foo |
|
69 | hg add foo | |
62 | hg qrefresh |
|
70 | hg qrefresh | |
@@ -100,14 +108,17 b" echo 'working dir diff:'" | |||||
100 | hg diff --nodates -q |
|
108 | hg diff --nodates -q | |
101 | # restore things |
|
109 | # restore things | |
102 | hg qrefresh |
|
110 | hg qrefresh | |
|
111 | checkundo qrefresh | |||
103 |
|
112 | |||
104 | echo % qpop |
|
113 | echo % qpop | |
105 |
|
114 | |||
106 | hg qpop |
|
115 | hg qpop | |
|
116 | checkundo qpop | |||
107 |
|
117 | |||
108 | echo % qpush |
|
118 | echo % qpush | |
109 |
|
119 | |||
110 | hg qpush |
|
120 | hg qpush | |
|
121 | checkundo qpush | |||
111 |
|
122 | |||
112 | cd .. |
|
123 | cd .. | |
113 |
|
124 | |||
@@ -394,6 +405,7 b' HGMERGE=true hg merge' | |||||
394 | hg ci -m merge -d '0 0' |
|
405 | hg ci -m merge -d '0 0' | |
395 | hg log |
|
406 | hg log | |
396 | hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
|
407 | hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' | |
|
408 | checkundo strip | |||
397 | hg log |
|
409 | hg log | |
398 | cd .. |
|
410 | cd .. | |
399 |
|
411 |
@@ -7,6 +7,13 b' rewrite_path()' | |||||
7 | sed -e 's:\\:/:g' -e 's:[^ ]*/t/::g' |
|
7 | sed -e 's:\\:/:g' -e 's:[^ ]*/t/::g' | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
|
10 | checkundo() | |||
|
11 | { | |||
|
12 | if [ -f .hg/store/undo ]; then | |||
|
13 | echo ".hg/store/undo still exists after $1" | |||
|
14 | fi | |||
|
15 | } | |||
|
16 | ||||
10 | echo "[extensions]" >> $HGRCPATH |
|
17 | echo "[extensions]" >> $HGRCPATH | |
11 | echo "hgext.mq=" >> $HGRCPATH |
|
18 | echo "hgext.mq=" >> $HGRCPATH | |
12 |
|
19 | |||
@@ -25,6 +32,7 b' hg qrefresh -m "rm a"' | |||||
25 |
|
32 | |||
26 | # Save the patch queue so we can merge it later |
|
33 | # Save the patch queue so we can merge it later | |
27 | hg qsave -c -e 2>&1 | rewrite_path |
|
34 | hg qsave -c -e 2>&1 | rewrite_path | |
|
35 | checkundo qsave | |||
28 |
|
36 | |||
29 | # Update b and commit in an "update" changeset |
|
37 | # Update b and commit in an "update" changeset | |
30 | hg up -C init |
|
38 | hg up -C init | |
@@ -36,6 +44,7 b' hg ci -m update' | |||||
36 | # The system cannot find the file specified => a |
|
44 | # The system cannot find the file specified => a | |
37 | hg manifest |
|
45 | hg manifest | |
38 | hg qpush -a -m 2>&1 | rewrite_path |
|
46 | hg qpush -a -m 2>&1 | rewrite_path | |
|
47 | checkundo 'qpush -m' | |||
39 | hg manifest |
|
48 | hg manifest | |
40 |
|
49 | |||
41 | # ensure status is correct after merge |
|
50 | # ensure status is correct after merge |
@@ -13,5 +13,6 b' hg verify 2>/dev/null || echo verify fai' | |||||
13 | chmod -w .hg/store/data/a.i |
|
13 | chmod -w .hg/store/data/a.i | |
14 | echo barber > a |
|
14 | echo barber > a | |
15 | hg commit -m "2" -d "1000000 0" 2>/dev/null || echo commit failed |
|
15 | hg commit -m "2" -d "1000000 0" 2>/dev/null || echo commit failed | |
16 |
chmod -w . |
|
16 | chmod -w . | |
17 | hg diff --nodates |
|
17 | hg diff --nodates | |
|
18 | chmod +w . |
@@ -101,6 +101,13 b' hg purge -v --force' | |||||
101 | hg revert --all --quiet |
|
101 | hg revert --all --quiet | |
102 | ls |
|
102 | ls | |
103 |
|
103 | |||
|
104 | echo '% tracked file in ignored directory (issue621)' | |||
|
105 | echo directory >> .hgignore | |||
|
106 | hg ci -m 'ignore directory' | |||
|
107 | touch untracked_file | |||
|
108 | hg purge -p | |||
|
109 | hg purge -v | |||
|
110 | ||||
104 | echo % skip excluded files |
|
111 | echo % skip excluded files | |
105 | touch excluded_file |
|
112 | touch excluded_file | |
106 | hg purge -p -X excluded_file |
|
113 | hg purge -p -X excluded_file |
@@ -59,6 +59,9 b' untracked_file still around' | |||||
59 | Removing file untracked_file |
|
59 | Removing file untracked_file | |
60 | directory |
|
60 | directory | |
61 | r1 |
|
61 | r1 | |
|
62 | % tracked file in ignored directory (issue621) | |||
|
63 | untracked_file | |||
|
64 | Removing file untracked_file | |||
62 | % skip excluded files |
|
65 | % skip excluded files | |
63 | directory |
|
66 | directory | |
64 | excluded_file |
|
67 | excluded_file |
@@ -116,13 +116,13 b' hg init t4' | |||||
116 | cd t4 |
|
116 | cd t4 | |
117 | echo foo > foo |
|
117 | echo foo > foo | |
118 | hg add |
|
118 | hg add | |
119 |
hg ci -m 'add foo' |
|
119 | hg ci -m 'add foo' # rev 0 | |
120 |
hg tag |
|
120 | hg tag bar # rev 1 bar -> 0 | |
121 |
hg tag - |
|
121 | hg tag -f bar # rev 2 bar -> 1 | |
122 | hg up -qC 0 |
|
122 | hg up -qC 0 | |
123 |
hg tag - |
|
123 | hg tag -fr 2 bar # rev 3 bar -> 2 | |
124 | hg tags |
|
124 | hg tags | |
125 | hg up -qC 0 |
|
125 | hg up -qC 0 | |
126 |
hg tag - |
|
126 | hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 | |
127 | echo % bar should still point to rev 2 |
|
127 | echo % bar should still point to rev 2 | |
128 | hg tags |
|
128 | hg tags |
@@ -6,6 +6,9 b' import os' | |||||
6 | from mercurial import ui, util |
|
6 | from mercurial import ui, util | |
7 |
|
7 | |||
8 | hgrc = os.environ['HGRCPATH'] |
|
8 | hgrc = os.environ['HGRCPATH'] | |
|
9 | f = open(hgrc) | |||
|
10 | basehgrc = f.read() | |||
|
11 | f.close() | |||
9 |
|
12 | |||
10 | def testui(user='foo', group='bar', tusers=(), tgroups=(), |
|
13 | def testui(user='foo', group='bar', tusers=(), tgroups=(), | |
11 | cuser='foo', cgroup='bar', debug=False, silent=False): |
|
14 | cuser='foo', cgroup='bar', debug=False, silent=False): | |
@@ -16,7 +19,8 b" def testui(user='foo', group='bar', tuse" | |||||
16 | # write a global hgrc with the list of trusted users/groups and |
|
19 | # write a global hgrc with the list of trusted users/groups and | |
17 | # some setting so that we can be sure it was read |
|
20 | # some setting so that we can be sure it was read | |
18 | f = open(hgrc, 'w') |
|
21 | f = open(hgrc, 'w') | |
19 |
f.write( |
|
22 | f.write(basehgrc) | |
|
23 | f.write('\n[paths]\n') | |||
20 | f.write('global = /some/path\n\n') |
|
24 | f.write('global = /some/path\n\n') | |
21 |
|
25 | |||
22 | if tusers or tgroups: |
|
26 | if tusers or tgroups: |
@@ -4,6 +4,9 b' import os' | |||||
4 | from mercurial import ui |
|
4 | from mercurial import ui | |
5 |
|
5 | |||
6 | hgrc = os.environ['HGRCPATH'] |
|
6 | hgrc = os.environ['HGRCPATH'] | |
|
7 | f = open(hgrc) | |||
|
8 | basehgrc = f.read() | |||
|
9 | f.close() | |||
7 |
|
10 | |||
8 | print ' hgrc settings command line options final result ' |
|
11 | print ' hgrc settings command line options final result ' | |
9 | print ' quiet verbo debug quiet verbo debug quiet verbo debug' |
|
12 | print ' quiet verbo debug quiet verbo debug quiet verbo debug' | |
@@ -17,7 +20,8 b' for i in xrange(64):' | |||||
17 | cmd_debug = bool(i & 1<<5) |
|
20 | cmd_debug = bool(i & 1<<5) | |
18 |
|
21 | |||
19 | f = open(hgrc, 'w') |
|
22 | f = open(hgrc, 'w') | |
20 |
f.write( |
|
23 | f.write(basehgrc) | |
|
24 | f.write('\n[ui]\n') | |||
21 | if hgrc_quiet: |
|
25 | if hgrc_quiet: | |
22 | f.write('quiet = True\n') |
|
26 | f.write('quiet = True\n') | |
23 | if hgrc_verbose: |
|
27 | if hgrc_verbose: |
General Comments 0
You need to be logged in to leave comments.
Login now