Show More
@@ -1,45 +1,41 b'' | |||||
1 | # Mercurial extension to provide the 'hg children' command |
|
1 | # Mercurial extension to provide the 'hg children' command | |
2 | # |
|
2 | # | |
3 | # Copyright 2007 by Intevation GmbH <intevation@intevation.de> |
|
3 | # Copyright 2007 by Intevation GmbH <intevation@intevation.de> | |
4 | # Author(s): |
|
4 | # Author(s): | |
5 | # Thomas Arendsen Hein <thomas@intevation.de> |
|
5 | # Thomas Arendsen Hein <thomas@intevation.de> | |
6 | # |
|
6 | # | |
7 | # This software may be used and distributed according to the terms |
|
7 | # This software may be used and distributed according to the terms | |
8 | # of the GNU General Public License, incorporated herein by reference. |
|
8 | # of the GNU General Public License, incorporated herein by reference. | |
9 |
|
9 | |||
10 |
from mercurial import cmdutil |
|
10 | from mercurial import cmdutil | |
11 | from mercurial.i18n import _ |
|
11 | from mercurial.i18n import _ | |
12 | from mercurial.node import nullid |
|
|||
13 |
|
12 | |||
14 |
|
13 | |||
15 | def children(ui, repo, file_=None, **opts): |
|
14 | def children(ui, repo, file_=None, **opts): | |
16 | """show the children of the given or working dir revision |
|
15 | """show the children of the given or working dir revision | |
17 |
|
16 | |||
18 | Print the children of the working directory's revisions. |
|
17 | Print the children of the working directory's revisions. | |
19 | If a revision is given via --rev, the children of that revision |
|
18 | If a revision is given via --rev, the children of that revision | |
20 | will be printed. If a file argument is given, revision in |
|
19 | will be printed. If a file argument is given, revision in | |
21 | which the file was last changed (after the working directory |
|
20 | which the file was last changed (after the working directory | |
22 | revision or the argument to --rev if given) is printed. |
|
21 | revision or the argument to --rev if given) is printed. | |
23 | """ |
|
22 | """ | |
24 | rev = opts.get('rev') |
|
23 | rev = opts.get('rev') | |
25 | if file_: |
|
24 | if file_: | |
26 | ctx = repo.filectx(file_, changeid=rev) |
|
25 | ctx = repo.filectx(file_, changeid=rev) | |
27 | else: |
|
26 | else: | |
28 | ctx = repo.changectx(rev) |
|
27 | ctx = repo.changectx(rev) | |
29 | if ctx.node() == nullid: |
|
|||
30 | raise util.Abort(_("All non-merge changesets are children of " |
|
|||
31 | "the null revision!")) |
|
|||
32 |
|
28 | |||
33 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
29 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
34 | for node in [cp.node() for cp in ctx.children()]: |
|
30 | for node in [cp.node() for cp in ctx.children()]: | |
35 | displayer.show(changenode=node) |
|
31 | displayer.show(changenode=node) | |
36 |
|
32 | |||
37 |
|
33 | |||
38 | cmdtable = { |
|
34 | cmdtable = { | |
39 | "children": |
|
35 | "children": | |
40 | (children, |
|
36 | (children, | |
41 | [('r', 'rev', '', _('show children of the specified rev')), |
|
37 | [('r', 'rev', '', _('show children of the specified rev')), | |
42 | ('', 'style', '', _('display using template map file')), |
|
38 | ('', 'style', '', _('display using template map file')), | |
43 | ('', 'template', '', _('display with template'))], |
|
39 | ('', 'template', '', _('display with template'))], | |
44 | _('hg children [-r REV] [FILE]')), |
|
40 | _('hg children [-r REV] [FILE]')), | |
45 | } |
|
41 | } |
@@ -1,52 +1,62 b'' | |||||
1 | % init |
|
1 | % init | |
2 | % no working directory |
|
2 | % no working directory | |
3 | abort: All non-merge changesets are children of the null revision! |
|
|||
4 | % setup |
|
3 | % setup | |
5 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
4 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
6 | % hg children at revision 3 (tip) |
|
5 | % hg children at revision 3 (tip) | |
7 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
6 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
8 | % hg children at nullrev (should be 0 and 3) |
|
7 | % hg children at nullrev (should be 0 and 3) | |
9 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
8 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
10 | % hg children at revision 1 (should be 2) |
|
9 | % hg children at revision 1 (should be 2) | |
11 | changeset: 2:8f5eea5023c2 |
|
10 | changeset: 2:8f5eea5023c2 | |
12 | user: test |
|
11 | user: test | |
13 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
12 | date: Thu Jan 01 00:00:02 1970 +0000 | |
14 | summary: 2 |
|
13 | summary: 2 | |
15 |
|
14 | |||
16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
15 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
17 | % hg children at revision 2 (other head) |
|
16 | % hg children at revision 2 (other head) | |
18 | % hg children -r null |
|
17 | % hg children -r null | |
19 | abort: All non-merge changesets are children of the null revision! |
|
18 | changeset: 0:4df8521a7374 | |
|
19 | user: test | |||
|
20 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
21 | summary: 0 | |||
|
22 | ||||
|
23 | changeset: 3:e2962852269d | |||
|
24 | tag: tip | |||
|
25 | parent: -1:000000000000 | |||
|
26 | user: test | |||
|
27 | date: Thu Jan 01 00:00:03 1970 +0000 | |||
|
28 | summary: 3 | |||
|
29 | ||||
20 | % hg children -r 0 |
|
30 | % hg children -r 0 | |
21 | changeset: 1:708c093edef0 |
|
31 | changeset: 1:708c093edef0 | |
22 | user: test |
|
32 | user: test | |
23 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
33 | date: Thu Jan 01 00:00:01 1970 +0000 | |
24 | summary: 1 |
|
34 | summary: 1 | |
25 |
|
35 | |||
26 | % hg children -r 1 |
|
36 | % hg children -r 1 | |
27 | changeset: 2:8f5eea5023c2 |
|
37 | changeset: 2:8f5eea5023c2 | |
28 | user: test |
|
38 | user: test | |
29 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
39 | date: Thu Jan 01 00:00:02 1970 +0000 | |
30 | summary: 2 |
|
40 | summary: 2 | |
31 |
|
41 | |||
32 | % hg children -r 2 |
|
42 | % hg children -r 2 | |
33 | % hg children -r 3 |
|
43 | % hg children -r 3 | |
34 | % hg children -r 0 file0 (should be 2) |
|
44 | % hg children -r 0 file0 (should be 2) | |
35 | changeset: 2:8f5eea5023c2 |
|
45 | changeset: 2:8f5eea5023c2 | |
36 | user: test |
|
46 | user: test | |
37 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
47 | date: Thu Jan 01 00:00:02 1970 +0000 | |
38 | summary: 2 |
|
48 | summary: 2 | |
39 |
|
49 | |||
40 | % hg children -r 1 file0 (should be 2) |
|
50 | % hg children -r 1 file0 (should be 2) | |
41 | changeset: 2:8f5eea5023c2 |
|
51 | changeset: 2:8f5eea5023c2 | |
42 | user: test |
|
52 | user: test | |
43 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
53 | date: Thu Jan 01 00:00:02 1970 +0000 | |
44 | summary: 2 |
|
54 | summary: 2 | |
45 |
|
55 | |||
46 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
56 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
47 | % hg children file0 at revision 0 (should be 2) |
|
57 | % hg children file0 at revision 0 (should be 2) | |
48 | changeset: 2:8f5eea5023c2 |
|
58 | changeset: 2:8f5eea5023c2 | |
49 | user: test |
|
59 | user: test | |
50 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
60 | date: Thu Jan 01 00:00:02 1970 +0000 | |
51 | summary: 2 |
|
61 | summary: 2 | |
52 |
|
62 |
General Comments 0
You need to be logged in to leave comments.
Login now