comparison test-onsub.t @ 12:90b54c4fe4fe

onsub extension: pre and post order
author jakob krainz <jakob@hawo-net.de>
date Tue, 06 Mar 2012 12:55:40 +0100
parents 4cb3f28590fd
children b10dd4461b52
comparison
equal deleted inserted replaced
11:4cb3f28590fd 12:90b54c4fe4fe
37 State of the current subrepository as specified in the containing 37 State of the current subrepository as specified in the containing
38 repository's ".hgsubstate" file. 38 repository's ".hgsubstate" file.
39 39
40 options: 40 options:
41 41
42 -b --breadth-first use breadth-first traversal 42 -b --breadth-first use breadth-first traversal
43 --max-depth N limit recursion to N levels (negative for no limit) 43 -p --post-order use post-order depth-first traversal
44 (default: -1) 44 --root-repo include root repository in traversal
45 --ignore-errors continue execution despite errors 45 --max-depth N limit recursion to N levels (negative for no limit)
46 -0 --print0 end subrepository names with NUL, for use with xargs 46 (default: -1)
47 --ignore-errors continue execution despite errors
48 -0 --print0 end subrepository names with NUL, for use with xargs
47 49
48 use "hg -v help onsub" to show global options 50 use "hg -v help onsub" to show global options
49 51
50 Create some nicely nested subrepositories: 52 Create some nicely nested subrepositories:
51 53
79 committing subrepository a/y/t 81 committing subrepository a/y/t
80 committing subrepository b 82 committing subrepository b
81 committing subrepository b/u 83 committing subrepository b/u
82 committing subrepository b/v 84 committing subrepository b/v
83 85
84 The default depth-first traversal: 86 The default depth-first pre-order traversal:
85 87
86 $ hg onsub 'echo $HG_SUBPATH' 88 $ hg onsub 'echo $HG_SUBPATH'
87 a 89 a
88 a/x 90 a/x
89 a/y 91 a/y
91 a/y/s 93 a/y/s
92 a/y/t 94 a/y/t
93 b 95 b
94 b/u 96 b/u
95 b/v 97 b/v
98
99 Traversal including the root repository:
100
101 $ hg onsub 'echo $HG_SUBPATH' --root-repo
102 .
103 a
104 a/x
105 a/y
106 a/y/r
107 a/y/s
108 a/y/t
109 b
110 b/u
111 b/v
112
113 Depth-first post-order traversal:
114
115 $ hg onsub 'echo $HG_SUBPATH' --post-order
116 a/x
117 a/y/r
118 a/y/s
119 a/y/t
120 a/y
121 a
122 b/u
123 b/v
124 b
125
126 Depth-first pre- and post-order traversal:
127
128 $ hg onsub 'echo pre $HG_SUBPATH' 'echo post $HG_SUBPATH'
129 pre a
130 pre a/x
131 post a/x
132 pre a/y
133 pre a/y/r
134 post a/y/r
135 pre a/y/s
136 post a/y/s
137 pre a/y/t
138 post a/y/t
139 post a/y
140 post a
141 pre b
142 pre b/u
143 post b/u
144 pre b/v
145 post b/v
146 post b
96 147
97 Breadth-first traversal: 148 Breadth-first traversal:
98 149
99 $ hg onsub 'echo $HG_SUBPATH' --breadth-first 150 $ hg onsub 'echo $HG_SUBPATH' --breadth-first
100 a 151 a
123 b 174 b
124 a/x 175 a/x
125 a/y 176 a/y
126 b/u 177 b/u
127 b/v 178 b/v
179 $ hg onsub --max-depth 1 -b --root-repo 'echo $HG_SUBPATH'
180 .
181 a
182 b
128 183
129 Test aborting: 184 Test aborting:
130 185
131 $ hg onsub -v 'test $HG_SUBPATH != "a/y/r"' 186 $ hg onsub -v 'test $HG_SUBPATH != "a/y/r"'
132 executing 'test $HG_SUBPATH != "a/y/r"' in a 187 executing 'test $HG_SUBPATH != "a/y/r"' in a