Show More
@@ -0,0 +1,38 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | try() { | |||
|
4 | echo '% hg debugrevspec' $@ | |||
|
5 | hg debugrevspec $@ | |||
|
6 | } | |||
|
7 | ||||
|
8 | hg init repo | |||
|
9 | cd repo | |||
|
10 | hg branch a | |||
|
11 | hg ci -m "plain name" | |||
|
12 | hg branch b | |||
|
13 | hg ci -m "another plain name" | |||
|
14 | hg branch a-b-c- | |||
|
15 | hg ci -m "with dashes" | |||
|
16 | hg branch -- -a-b-c- | |||
|
17 | hg ci -m "with leading dash" | |||
|
18 | hg branch +a+b+c+ | |||
|
19 | hg ci -m "with plusses" | |||
|
20 | hg branch /a/b/c/ | |||
|
21 | hg ci -m "with slashes" | |||
|
22 | hg branch _a_b_c_ | |||
|
23 | hg ci -m "with underscores" | |||
|
24 | hg branch .a.b.c. | |||
|
25 | hg ci -m "with dots" | |||
|
26 | ||||
|
27 | # names that should work without quoting | |||
|
28 | try a | |||
|
29 | try b-a | |||
|
30 | try _a_b_c_ | |||
|
31 | try _a_b_c_-a | |||
|
32 | try .a.b.c. | |||
|
33 | try .a.b.c.-a | |||
|
34 | ||||
|
35 | # quoting needed | |||
|
36 | try '"-a-b-c-"' | |||
|
37 | try '"-a-b-c-"-a' | |||
|
38 |
@@ -0,0 +1,24 b'' | |||||
|
1 | marked working directory as branch a | |||
|
2 | marked working directory as branch b | |||
|
3 | marked working directory as branch a-b-c- | |||
|
4 | marked working directory as branch -a-b-c- | |||
|
5 | marked working directory as branch +a+b+c+ | |||
|
6 | marked working directory as branch /a/b/c/ | |||
|
7 | marked working directory as branch _a_b_c_ | |||
|
8 | marked working directory as branch .a.b.c. | |||
|
9 | % hg debugrevspec a | |||
|
10 | 0 | |||
|
11 | % hg debugrevspec b-a | |||
|
12 | 1 | |||
|
13 | % hg debugrevspec _a_b_c_ | |||
|
14 | 6 | |||
|
15 | % hg debugrevspec _a_b_c_-a | |||
|
16 | 6 | |||
|
17 | % hg debugrevspec .a.b.c. | |||
|
18 | 7 | |||
|
19 | % hg debugrevspec .a.b.c.-a | |||
|
20 | 7 | |||
|
21 | % hg debugrevspec "-a-b-c-" | |||
|
22 | 3 | |||
|
23 | % hg debugrevspec "-a-b-c-"-a | |||
|
24 | 3 |
@@ -78,6 +78,9 b' def _runpager(p):' | |||||
78 | raise |
|
78 | raise | |
79 |
|
79 | |||
80 | def uisetup(ui): |
|
80 | def uisetup(ui): | |
|
81 | if ui.plain(): | |||
|
82 | return | |||
|
83 | ||||
81 | def pagecmd(orig, ui, options, cmd, cmdfunc): |
|
84 | def pagecmd(orig, ui, options, cmd, cmdfunc): | |
82 | p = ui.config("pager", "pager", os.environ.get("PAGER")) |
|
85 | p = ui.config("pager", "pager", os.environ.get("PAGER")) | |
83 | if p and sys.stdout.isatty() and '--debugger' not in sys.argv: |
|
86 | if p and sys.stdout.isatty() and '--debugger' not in sys.argv: |
@@ -235,7 +235,15 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
235 |
|
235 | |||
236 | _charsets = mail._charsets(ui) |
|
236 | _charsets = mail._charsets(ui) | |
237 |
|
237 | |||
238 | def outgoing(dest, revs): |
|
238 | bundle = opts.get('bundle') | |
|
239 | date = opts.get('date') | |||
|
240 | mbox = opts.get('mbox') | |||
|
241 | outgoing = opts.get('outgoing') | |||
|
242 | rev = opts.get('rev') | |||
|
243 | # internal option used by pbranches | |||
|
244 | patches = opts.get('patches') | |||
|
245 | ||||
|
246 | def getoutgoing(dest, revs): | |||
239 | '''Return the revisions present locally but not in dest''' |
|
247 | '''Return the revisions present locally but not in dest''' | |
240 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
248 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
241 | dest, branches = hg.parseurl(dest) |
|
249 | dest, branches = hg.parseurl(dest) | |
@@ -271,38 +279,36 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
271 | pass |
|
279 | pass | |
272 | os.rmdir(tmpdir) |
|
280 | os.rmdir(tmpdir) | |
273 |
|
281 | |||
274 |
if not (opts.get('test') or |
|
282 | if not (opts.get('test') or mbox): | |
275 | # really sending |
|
283 | # really sending | |
276 | mail.validateconfig(ui) |
|
284 | mail.validateconfig(ui) | |
277 |
|
285 | |||
278 | if not (revs or opts.get('rev') |
|
286 | if not (revs or rev or outgoing or bundle or patches): | |
279 | or opts.get('outgoing') or opts.get('bundle') |
|
|||
280 | or opts.get('patches')): |
|
|||
281 | raise util.Abort(_('specify at least one changeset with -r or -o')) |
|
287 | raise util.Abort(_('specify at least one changeset with -r or -o')) | |
282 |
|
288 | |||
283 |
if |
|
289 | if outgoing and bundle: | |
284 | raise util.Abort(_("--outgoing mode always on with --bundle;" |
|
290 | raise util.Abort(_("--outgoing mode always on with --bundle;" | |
285 | " do not re-specify --outgoing")) |
|
291 | " do not re-specify --outgoing")) | |
286 |
|
292 | |||
287 |
if |
|
293 | if outgoing or bundle: | |
288 | if len(revs) > 1: |
|
294 | if len(revs) > 1: | |
289 | raise util.Abort(_("too many destinations")) |
|
295 | raise util.Abort(_("too many destinations")) | |
290 | dest = revs and revs[0] or None |
|
296 | dest = revs and revs[0] or None | |
291 | revs = [] |
|
297 | revs = [] | |
292 |
|
298 | |||
293 |
if |
|
299 | if rev: | |
294 | if revs: |
|
300 | if revs: | |
295 | raise util.Abort(_('use only one form to specify the revision')) |
|
301 | raise util.Abort(_('use only one form to specify the revision')) | |
296 |
revs = |
|
302 | revs = rev | |
297 |
|
303 | |||
298 |
if |
|
304 | if outgoing: | |
299 |
revs = outgoing(dest, |
|
305 | revs = getoutgoing(dest, rev) | |
300 |
if |
|
306 | if bundle: | |
301 | opts['revs'] = revs |
|
307 | opts['revs'] = revs | |
302 |
|
308 | |||
303 | # start |
|
309 | # start | |
304 |
if |
|
310 | if date: | |
305 |
start_time = util.parsedate( |
|
311 | start_time = util.parsedate(date) | |
306 | else: |
|
312 | else: | |
307 | start_time = util.makedate() |
|
313 | start_time = util.makedate() | |
308 |
|
314 | |||
@@ -381,11 +387,9 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
381 | ui.config('patchbomb', 'from') or |
|
387 | ui.config('patchbomb', 'from') or | |
382 | prompt(ui, 'From', ui.username())) |
|
388 | prompt(ui, 'From', ui.username())) | |
383 |
|
389 | |||
384 | # internal option used by pbranches |
|
|||
385 | patches = opts.get('patches') |
|
|||
386 | if patches: |
|
390 | if patches: | |
387 | msgs = getpatchmsgs(patches, opts.get('patchnames')) |
|
391 | msgs = getpatchmsgs(patches, opts.get('patchnames')) | |
388 |
elif |
|
392 | elif bundle: | |
389 | msgs = getbundlemsgs(getbundle(dest)) |
|
393 | msgs = getbundlemsgs(getbundle(dest)) | |
390 | else: |
|
394 | else: | |
391 | msgs = getpatchmsgs(list(getpatches(revs))) |
|
395 | msgs = getpatchmsgs(list(getpatches(revs))) | |
@@ -463,9 +467,9 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
463 | raise |
|
467 | raise | |
464 | if fp is not ui: |
|
468 | if fp is not ui: | |
465 | fp.close() |
|
469 | fp.close() | |
466 |
elif |
|
470 | elif mbox: | |
467 | ui.status(_('Writing '), subj, ' ...\n') |
|
471 | ui.status(_('Writing '), subj, ' ...\n') | |
468 |
fp = open( |
|
472 | fp = open(mbox, 'In-Reply-To' in m and 'ab+' or 'wb+') | |
469 | generator = email.Generator.Generator(fp, mangle_from_=True) |
|
473 | generator = email.Generator.Generator(fp, mangle_from_=True) | |
470 | # Should be time.asctime(), but Windows prints 2-characters day |
|
474 | # Should be time.asctime(), but Windows prints 2-characters day | |
471 | # of month instead of one. Make them print the same thing. |
|
475 | # of month instead of one. Make them print the same thing. |
@@ -341,7 +341,7 b' class transplanter(object):' | |||||
341 | node = revlog.bin(line[10:]) |
|
341 | node = revlog.bin(line[10:]) | |
342 | elif line.startswith('# Parent '): |
|
342 | elif line.startswith('# Parent '): | |
343 | parents.append(revlog.bin(line[9:])) |
|
343 | parents.append(revlog.bin(line[9:])) | |
344 | elif not line.startswith('#'): |
|
344 | elif not line.startswith('# '): | |
345 | inmsg = True |
|
345 | inmsg = True | |
346 | message.append(line) |
|
346 | message.append(line) | |
347 | return (node, user, date, '\n'.join(message), parents) |
|
347 | return (node, user, date, '\n'.join(message), parents) |
@@ -163,12 +163,13 b' def revrange(repo, revs):' | |||||
163 | seen.add(rev) |
|
163 | seen.add(rev) | |
164 | l.append(rev) |
|
164 | l.append(rev) | |
165 | continue |
|
165 | continue | |
166 | elif spec in repo: # single unquoted rev |
|
166 | elif spec and spec in repo: # single unquoted rev | |
167 | rev = revfix(repo, spec, None) |
|
167 | rev = revfix(repo, spec, None) | |
168 | if rev in seen: |
|
168 | if rev in seen: | |
169 | continue |
|
169 | continue | |
170 | seen.add(rev) |
|
170 | seen.add(rev) | |
171 | l.append(rev) |
|
171 | l.append(rev) | |
|
172 | continue | |||
172 | except error.RepoLookupError: |
|
173 | except error.RepoLookupError: | |
173 | pass |
|
174 | pass | |
174 |
|
175 |
@@ -22,6 +22,19 b' On Unix, these files are read:' | |||||
22 | - ``<install-root>/etc/mercurial/hgrc`` |
|
22 | - ``<install-root>/etc/mercurial/hgrc`` | |
23 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
23 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` | |
24 |
|
24 | |||
|
25 | If there is a per-repository configuration file which is not owned by | |||
|
26 | the active user, Mercurial will warn you that the file is skipped:: | |||
|
27 | ||||
|
28 | not trusting file <repo>/.hg/hgrc from untrusted user USER, group GROUP | |||
|
29 | ||||
|
30 | If this bothers you, the warning can be silenced (the file would still | |||
|
31 | be ignored) or trust can be established. Use one of the following | |||
|
32 | settings, the syntax is explained below: | |||
|
33 | ||||
|
34 | - ``ui.report_untrusted = False`` | |||
|
35 | - ``trusted.users = USER`` | |||
|
36 | - ``trusted.groups = GROUP`` | |||
|
37 | ||||
25 | The configuration files for Mercurial use a simple ini-file format. A |
|
38 | The configuration files for Mercurial use a simple ini-file format. A | |
26 | configuration file consists of sections, led by a ``[section]`` header |
|
39 | configuration file consists of sections, led by a ``[section]`` header | |
27 | and followed by ``name = value`` entries:: |
|
40 | and followed by ``name = value`` entries:: |
@@ -467,7 +467,8 b' def update(repo, node, branchmerge, forc' | |||||
467 | raise util.Abort(_("outstanding uncommitted merges")) |
|
467 | raise util.Abort(_("outstanding uncommitted merges")) | |
468 | if branchmerge: |
|
468 | if branchmerge: | |
469 | if pa == p2: |
|
469 | if pa == p2: | |
470 |
raise util.Abort(_(" |
|
470 | raise util.Abort(_("merging with a working directory ancestor" | |
|
471 | " has no effect")) | |||
471 | elif pa == p1: |
|
472 | elif pa == p1: | |
472 | if p1.branch() != p2.branch(): |
|
473 | if p1.branch() != p2.branch(): | |
473 | fastforward = True |
|
474 | fastforward = True |
@@ -62,13 +62,13 b' class parser(object):' | |||||
62 | expr = (suffix[0], expr) |
|
62 | expr = (suffix[0], expr) | |
63 | else: |
|
63 | else: | |
64 | # handle infix rules |
|
64 | # handle infix rules | |
65 |
i |
|
65 | if len(e) < 3 or not e[2]: | |
|
66 | raise error.ParseError("not an infix: %s" % token, pos) | |||
|
67 | infix = e[2] | |||
66 | if len(infix) == 3 and infix[2] == self.current[0]: |
|
68 | if len(infix) == 3 and infix[2] == self.current[0]: | |
67 | self._match(infix[2], pos) |
|
69 | self._match(infix[2], pos) | |
68 | expr = (infix[0], expr, (None)) |
|
70 | expr = (infix[0], expr, (None)) | |
69 | else: |
|
71 | else: | |
70 | if not infix[0]: |
|
|||
71 | raise error.ParseError("not an infix: %s" % token, pos) |
|
|||
72 | expr = (infix[0], expr, self._parse(infix[1])) |
|
72 | expr = (infix[0], expr, self._parse(infix[1])) | |
73 | if len(infix) == 3: |
|
73 | if len(infix) == 3: | |
74 | self._match(infix[2], pos) |
|
74 | self._match(infix[2], pos) |
@@ -369,7 +369,7 b' class ui(object):' | |||||
369 | if not getattr(sys.stderr, 'closed', False): |
|
369 | if not getattr(sys.stderr, 'closed', False): | |
370 | sys.stderr.flush() |
|
370 | sys.stderr.flush() | |
371 | except IOError, inst: |
|
371 | except IOError, inst: | |
372 |
if inst.errno |
|
372 | if inst.errno not in (errno.EPIPE, errno.EIO): | |
373 | raise |
|
373 | raise | |
374 |
|
374 | |||
375 | def flush(self): |
|
375 | def flush(self): |
@@ -556,6 +556,13 b' class httpdigestauthhandler(urllib2.HTTP' | |||||
556 | return |
|
556 | return | |
557 | raise |
|
557 | raise | |
558 |
|
558 | |||
|
559 | # Python 2.6.5 will keep resetting the retry count on redirects, for | |||
|
560 | # example when the server returns 401 on failing auth (like google code | |||
|
561 | # currently does). We stop the endless recursion by not resetting the | |||
|
562 | # count. | |||
|
563 | def reset_retry_count(self): | |||
|
564 | pass | |||
|
565 | ||||
559 | def getauthinfo(path): |
|
566 | def getauthinfo(path): | |
560 | scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) |
|
567 | scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) | |
561 | if not urlpath: |
|
568 | if not urlpath: |
@@ -296,31 +296,31 b' rename to bar' | |||||
296 | EOF |
|
296 | EOF | |
297 | cd .. |
|
297 | cd .. | |
298 |
|
298 | |||
299 | echo '% test import with similarity (issue295)' |
|
299 | echo '% test import with similarity and git and strip (issue295 et al.)' | |
300 | hg init sim |
|
300 | hg init sim | |
301 | cd sim |
|
301 | cd sim | |
302 | echo 'this is a test' > a |
|
302 | echo 'this is a test' > a | |
303 | hg ci -Ama |
|
303 | hg ci -Ama | |
304 | cat > ../rename.diff <<EOF |
|
304 | cat > ../rename.diff <<EOF | |
305 | diff --git a/a b/a |
|
305 | diff --git a/foo/a b/foo/a | |
306 | deleted file mode 100644 |
|
306 | deleted file mode 100644 | |
307 | --- a/a |
|
307 | --- a/foo/a | |
308 | +++ /dev/null |
|
308 | +++ /dev/null | |
309 | @@ -1,1 +0,0 @@ |
|
309 | @@ -1,1 +0,0 @@ | |
310 | -this is a test |
|
310 | -this is a test | |
311 | diff --git a/b b/b |
|
311 | diff --git a/foo/b b/foo/b | |
312 | new file mode 100644 |
|
312 | new file mode 100644 | |
313 | --- /dev/null |
|
313 | --- /dev/null | |
314 | +++ b/b |
|
314 | +++ b/foo/b | |
315 | @@ -0,0 +1,2 @@ |
|
315 | @@ -0,0 +1,2 @@ | |
316 | +this is a test |
|
316 | +this is a test | |
317 | +foo |
|
317 | +foo | |
318 | EOF |
|
318 | EOF | |
319 | hg import --no-commit -v -s 1 ../rename.diff |
|
319 | hg import --no-commit -v -s 1 ../rename.diff -p2 | |
320 | hg st -C |
|
320 | hg st -C | |
321 | hg revert -a |
|
321 | hg revert -a | |
322 | rm b |
|
322 | rm b | |
323 | hg import --no-commit -v -s 100 ../rename.diff |
|
323 | hg import --no-commit -v -s 100 ../rename.diff -p2 | |
324 | hg st -C |
|
324 | hg st -C | |
325 | cd .. |
|
325 | cd .. | |
326 |
|
326 |
@@ -279,7 +279,7 b' bb' | |||||
279 | % test paths outside repo root |
|
279 | % test paths outside repo root | |
280 | applying patch from stdin |
|
280 | applying patch from stdin | |
281 | abort: ../outside/foo not under root |
|
281 | abort: ../outside/foo not under root | |
282 | % test import with similarity (issue295) |
|
282 | % test import with similarity and git and strip (issue295 et al.) | |
283 | adding a |
|
283 | adding a | |
284 | applying ../rename.diff |
|
284 | applying ../rename.diff | |
285 | patching file a |
|
285 | patching file a |
@@ -6,5 +6,5 b' fast-forward' | |||||
6 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
6 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
7 | (branch merge, don't forget to commit) |
|
7 | (branch merge, don't forget to commit) | |
8 | bogus fast-forward should fail |
|
8 | bogus fast-forward should fail | |
9 | abort: can't merge with ancestor |
|
9 | abort: merging with a working directory ancestor has no effect | |
10 | done |
|
10 | done |
General Comments 0
You need to be logged in to leave comments.
Login now