##// END OF EJS Templates
children: don't pass filectx to displayer...
Yuya Nishihara -
r24482:3eb90453 default
parent child Browse files
Show More
@@ -1,49 +1,51 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 #
5 5 # Author(s):
6 6 # Thomas Arendsen Hein <thomas@intevation.de>
7 7 #
8 8 # This software may be used and distributed according to the terms of the
9 9 # GNU General Public License version 2 or any later version.
10 10
11 11 '''command to display child changesets (DEPRECATED)
12 12
13 13 This extension is deprecated. You should use :hg:`log -r
14 14 "children(REV)"` instead.
15 15 '''
16 16
17 17 from mercurial import cmdutil
18 18 from mercurial.commands import templateopts
19 19 from mercurial.i18n import _
20 20
21 21 cmdtable = {}
22 22 command = cmdutil.command(cmdtable)
23 23 testedwith = 'internal'
24 24
25 25 @command('children',
26 26 [('r', 'rev', '',
27 27 _('show children of the specified revision'), _('REV')),
28 28 ] + templateopts,
29 29 _('hg children [-r REV] [FILE]'),
30 30 inferrepo=True)
31 31 def children(ui, repo, file_=None, **opts):
32 32 """show the children of the given or working directory revision
33 33
34 34 Print the children of the working directory's revisions. If a
35 35 revision is given via -r/--rev, the children of that revision will
36 36 be printed. If a file argument is given, revision in which the
37 37 file was last changed (after the working directory revision or the
38 38 argument to --rev if given) is printed.
39 39 """
40 40 rev = opts.get('rev')
41 41 if file_:
42 ctx = repo.filectx(file_, changeid=rev)
42 fctx = repo.filectx(file_, changeid=rev)
43 childctxs = [fcctx.changectx() for fcctx in fctx.children()]
43 44 else:
44 45 ctx = repo[rev]
46 childctxs = ctx.children()
45 47
46 48 displayer = cmdutil.show_changeset(ui, repo, opts)
47 for cctx in ctx.children():
49 for cctx in childctxs:
48 50 displayer.show(cctx)
49 51 displayer.close()
@@ -1,125 +1,133 b''
1 1 test children command
2 2
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [extensions]
5 5 > children =
6 6 > EOF
7 7
8 8 init
9 9 $ hg init t
10 10 $ cd t
11 11
12 12 no working directory
13 13 $ hg children
14 14
15 15 setup
16 16 $ echo 0 > file0
17 17 $ hg ci -qAm 0 -d '0 0'
18 18
19 19 $ echo 1 > file1
20 20 $ hg ci -qAm 1 -d '1 0'
21 21
22 22 $ echo 2 >> file0
23 23 $ hg ci -qAm 2 -d '2 0'
24 24
25 25 $ hg co null
26 26 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
27 27 $ echo 3 > file3
28 28 $ hg ci -qAm 3 -d '3 0'
29 29
30 30 hg children at revision 3 (tip)
31 31 $ hg children
32 32
33 33 $ hg co null
34 34 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
35 35
36 36 hg children at nullrev (should be 0 and 3)
37 37 $ hg children
38 38 changeset: 0:4df8521a7374
39 39 user: test
40 40 date: Thu Jan 01 00:00:00 1970 +0000
41 41 summary: 0
42 42
43 43 changeset: 3:e2962852269d
44 44 tag: tip
45 45 parent: -1:000000000000
46 46 user: test
47 47 date: Thu Jan 01 00:00:03 1970 +0000
48 48 summary: 3
49 49
50 50 $ hg co 1
51 51 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 52
53 53 hg children at revision 1 (should be 2)
54 54 $ hg children
55 55 changeset: 2:8f5eea5023c2
56 56 user: test
57 57 date: Thu Jan 01 00:00:02 1970 +0000
58 58 summary: 2
59 59
60 60 $ hg co 2
61 61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 62
63 63 hg children at revision 2 (other head)
64 64 $ hg children
65 65
66 66 $ for i in null 0 1 2 3; do
67 67 > echo "hg children -r $i"
68 68 > hg children -r $i
69 69 > done
70 70 hg children -r null
71 71 changeset: 0:4df8521a7374
72 72 user: test
73 73 date: Thu Jan 01 00:00:00 1970 +0000
74 74 summary: 0
75 75
76 76 changeset: 3:e2962852269d
77 77 tag: tip
78 78 parent: -1:000000000000
79 79 user: test
80 80 date: Thu Jan 01 00:00:03 1970 +0000
81 81 summary: 3
82 82
83 83 hg children -r 0
84 84 changeset: 1:708c093edef0
85 85 user: test
86 86 date: Thu Jan 01 00:00:01 1970 +0000
87 87 summary: 1
88 88
89 89 hg children -r 1
90 90 changeset: 2:8f5eea5023c2
91 91 user: test
92 92 date: Thu Jan 01 00:00:02 1970 +0000
93 93 summary: 2
94 94
95 95 hg children -r 2
96 96 hg children -r 3
97 97
98 98 hg children -r 0 file0 (should be 2)
99 99 $ hg children -r 0 file0
100 100 changeset: 2:8f5eea5023c2
101 101 user: test
102 102 date: Thu Jan 01 00:00:02 1970 +0000
103 103 summary: 2
104 104
105 105
106 106 hg children -r 1 file0 (should be 2)
107 107 $ hg children -r 1 file0
108 108 changeset: 2:8f5eea5023c2
109 109 user: test
110 110 date: Thu Jan 01 00:00:02 1970 +0000
111 111 summary: 2
112 112
113 113
114 114 $ hg co 0
115 115 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
116 116
117 117 hg children file0 at revision 0 (should be 2)
118 118 $ hg children file0
119 119 changeset: 2:8f5eea5023c2
120 120 user: test
121 121 date: Thu Jan 01 00:00:02 1970 +0000
122 122 summary: 2
123 123
124 124
125 should be compatible with templater (don't pass fctx to displayer)
126 $ hg children file0 -Tdefault
127 changeset: 2:8f5eea5023c2
128 user: test
129 date: Thu Jan 01 00:00:02 1970 +0000
130 summary: 2
131
132
125 133 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now