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