Show More
@@ -108,7 +108,7 b" svnisodate = lambda x: util.datestr(x, '" | |||
|
108 | 108 | svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ') |
|
109 | 109 | |
|
110 | 110 | # make keyword tools accessible |
|
111 |
kwtools = {'templater': None, 'hgcmd': '' |
|
|
111 | kwtools = {'templater': None, 'hgcmd': ''} | |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | def _defaultkwmaps(ui): |
@@ -141,11 +141,10 b' class kwtemplater(object):' | |||
|
141 | 141 | provides keyword substitution functions. |
|
142 | 142 | ''' |
|
143 | 143 | |
|
144 | def __init__(self, ui, repo): | |
|
144 | def __init__(self, ui, repo, inc, exc): | |
|
145 | 145 | self.ui = ui |
|
146 | 146 | self.repo = repo |
|
147 | self.match = match.match(repo.root, '', [], | |
|
148 | kwtools['inc'], kwtools['exc']) | |
|
147 | self.match = match.match(repo.root, '', [], inc, exc) | |
|
149 | 148 | self.restrict = kwtools['hgcmd'] in restricted.split() |
|
150 | 149 | self.record = kwtools['hgcmd'] in recordcommands.split() |
|
151 | 150 | |
@@ -438,16 +437,8 b' def shrink(ui, repo, *pats, **opts):' | |||
|
438 | 437 | |
|
439 | 438 | |
|
440 | 439 | def uisetup(ui): |
|
441 | '''Collects [keyword] config in kwtools. | |
|
442 | Monkeypatches dispatch._parse if needed.''' | |
|
440 | ''' Monkeypatches dispatch._parse to retrieve user command.''' | |
|
443 | 441 | |
|
444 | for pat, opt in ui.configitems('keyword'): | |
|
445 | if opt != 'ignore': | |
|
446 | kwtools['inc'].append(pat) | |
|
447 | else: | |
|
448 | kwtools['exc'].append(pat) | |
|
449 | ||
|
450 | if kwtools['inc']: | |
|
451 | 442 |
|
|
452 | 443 |
|
|
453 | 444 |
|
@@ -465,15 +456,23 b' def reposetup(ui, repo):' | |||
|
465 | 456 | Monkeypatches patch and webcommands.''' |
|
466 | 457 | |
|
467 | 458 | try: |
|
468 |
if (not repo.local() or |
|
|
469 | or kwtools['hgcmd'] in nokwcommands.split() | |
|
459 | if (not repo.local() or kwtools['hgcmd'] in nokwcommands.split() | |
|
470 | 460 | or '.hg' in util.splitpath(repo.root) |
|
471 | 461 | or repo._url.startswith('bundle:')): |
|
472 | 462 | return |
|
473 | 463 | except AttributeError: |
|
474 | 464 | pass |
|
475 | 465 | |
|
476 | kwtools['templater'] = kwt = kwtemplater(ui, repo) | |
|
466 | inc, exc = [], ['.hg*'] | |
|
467 | for pat, opt in ui.configitems('keyword'): | |
|
468 | if opt != 'ignore': | |
|
469 | inc.append(pat) | |
|
470 | else: | |
|
471 | exc.append(pat) | |
|
472 | if not inc: | |
|
473 | return | |
|
474 | ||
|
475 | kwtools['templater'] = kwt = kwtemplater(ui, repo, inc, exc) | |
|
477 | 476 | |
|
478 | 477 | class kwrepo(repo.__class__): |
|
479 | 478 | def file(self, f): |
@@ -262,7 +262,7 b' class cmdalias(object):' | |||
|
262 | 262 | if self.shadows: |
|
263 | 263 | ui.debug("alias '%s' shadows command\n" % self.name) |
|
264 | 264 | |
|
265 | return self.fn(ui, *args, **opts) | |
|
265 | return util.checksignature(self.fn)(ui, *args, **opts) | |
|
266 | 266 | |
|
267 | 267 | def addaliases(ui, cmdtable): |
|
268 | 268 | # aliases are processed after extensions have been loaded, so they |
@@ -380,7 +380,12 b' def _dispatch(ui, args):' | |||
|
380 | 380 | os.chdir(cwd[-1]) |
|
381 | 381 | |
|
382 | 382 | # read the local repository .hgrc into a local ui object |
|
383 | path = cmdutil.findrepo(os.getcwd()) or "" | |
|
383 | try: | |
|
384 | wd = os.getcwd() | |
|
385 | except OSError, e: | |
|
386 | raise util.Abort(_("error getting current working directory: %s") % | |
|
387 | e.strerror) | |
|
388 | path = cmdutil.findrepo(wd) or "" | |
|
384 | 389 | if not path: |
|
385 | 390 | lui = ui |
|
386 | 391 | else: |
@@ -32,7 +32,7 b' def findrepos(paths):' | |||
|
32 | 32 | except KeyError: |
|
33 | 33 | repos.append((prefix, root)) |
|
34 | 34 | continue |
|
35 | roothead = os.path.normpath(roothead) | |
|
35 | roothead = os.path.normpath(os.path.abspath(roothead)) | |
|
36 | 36 | for path in util.walkrepos(roothead, followsym=True, recurse=recurse): |
|
37 | 37 | path = os.path.normpath(path) |
|
38 | 38 | name = util.pconvert(path[len(roothead):]).strip('/') |
@@ -15,6 +15,7 b' dln = lognull --debug' | |||
|
15 | 15 | nousage = rollback |
|
16 | 16 | put = export -r 0 -o "\$FOO/%R.diff" |
|
17 | 17 | echo = !echo |
|
18 | rt = root | |
|
18 | 19 | |
|
19 | 20 | [defaults] |
|
20 | 21 | mylog = -q |
@@ -68,3 +69,7 b' cat 0.diff' | |||
|
68 | 69 | |
|
69 | 70 | echo '% shell aliases' |
|
70 | 71 | hg echo foo |
|
72 | echo '% invalid arguments' | |
|
73 | hg rt foo | |
|
74 | ||
|
75 | exit 0 |
@@ -45,3 +45,16 b' diff -r 000000000000 -r e63c23eaa88a foo' | |||
|
45 | 45 | +foo |
|
46 | 46 | % shell aliases |
|
47 | 47 | foo |
|
48 | % invalid arguments | |
|
49 | hg rt: invalid arguments | |
|
50 | hg rt | |
|
51 | ||
|
52 | alias for: hg root | |
|
53 | ||
|
54 | print the root (top) of the current working directory | |
|
55 | ||
|
56 | Print the root directory of the current repository. | |
|
57 | ||
|
58 | Returns 0 on success. | |
|
59 | ||
|
60 | use "hg -v help rt" to show global options |
@@ -3,6 +3,8 b'' | |||
|
3 | 3 | |
|
4 | 4 | "$TESTDIR/hghave" no-outer-repo || exit 80 |
|
5 | 5 | |
|
6 | dir=`pwd` | |
|
7 | ||
|
6 | 8 | hg init a |
|
7 | 9 | cd a |
|
8 | 10 | echo a > a |
@@ -19,8 +21,12 b' cat = -r null' | |||
|
19 | 21 | EOF |
|
20 | 22 | hg cat a |
|
21 | 23 | |
|
24 | echo '% working directory removed' | |
|
25 | rm -rf $dir/a | |
|
26 | hg --version | |
|
27 | ||
|
22 | 28 | echo '% no repo' |
|
23 | cd .. | |
|
29 | cd $dir | |
|
24 | 30 | hg cat |
|
25 | 31 | |
|
26 | 32 | exit 0 |
@@ -33,5 +33,7 b' use "hg -v help cat" to show global opti' | |||
|
33 | 33 | % [defaults] |
|
34 | 34 | a |
|
35 | 35 | a: No such file in rev 000000000000 |
|
36 | % working directory removed | |
|
37 | abort: error getting current working directory: No such file or directory | |
|
36 | 38 | % no repo |
|
37 | 39 | abort: There is no Mercurial repository here (.hg not found)! |
@@ -60,34 +60,38 b' hg help showoptlist' | |||
|
60 | 60 | #### - user names in annotate |
|
61 | 61 | #### - file names in diffstat |
|
62 | 62 | |
|
63 | rm -f s; touch s | |
|
64 | rm -f m; touch m | |
|
65 | rm -f l; touch l | |
|
66 | ||
|
63 | 67 | #### add files |
|
64 | 68 | |
|
65 | touch $S | |
|
69 | cp s $S | |
|
66 | 70 | hg add $S |
|
67 | touch $M | |
|
71 | cp m $M | |
|
68 | 72 | hg add $M |
|
69 | touch $L | |
|
73 | cp l $L | |
|
70 | 74 | hg add $L |
|
71 | 75 | |
|
72 | 76 | #### commit(1) |
|
73 | 77 | |
|
74 | echo 'first line(1)' >> $S | |
|
75 | echo 'first line(2)' >> $M | |
|
76 | echo 'first line(3)' >> $L | |
|
78 | echo 'first line(1)' >> s; cp s $S | |
|
79 | echo 'first line(2)' >> m; cp m $M | |
|
80 | echo 'first line(3)' >> l; cp l $L | |
|
77 | 81 | hg commit -m 'first commit' -u $S -d "1000000 0" |
|
78 | 82 | |
|
79 | 83 | #### commit(2) |
|
80 | 84 | |
|
81 | echo 'second line(1)' >> $S | |
|
82 | echo 'second line(2)' >> $M | |
|
83 | echo 'second line(3)' >> $L | |
|
85 | echo 'second line(1)' >> s; cp s $S | |
|
86 | echo 'second line(2)' >> m; cp m $M | |
|
87 | echo 'second line(3)' >> l; cp l $L | |
|
84 | 88 | hg commit -m 'second commit' -u $M -d "1000000 0" |
|
85 | 89 | |
|
86 | 90 | #### commit(3) |
|
87 | 91 | |
|
88 | echo 'third line(1)' >> $S | |
|
89 | echo 'third line(2)' >> $M | |
|
90 | echo 'third line(3)' >> $L | |
|
92 | echo 'third line(1)' >> s; cp s $S | |
|
93 | echo 'third line(2)' >> m; cp m $M | |
|
94 | echo 'third line(3)' >> l; cp l $L | |
|
91 | 95 | hg commit -m 'third commit' -u $L -d "1000000 0" |
|
92 | 96 | |
|
93 | 97 | #### check |
@@ -65,6 +65,8 b' t/a/=$root/a' | |||
|
65 | 65 | b=$root/b |
|
66 | 66 | coll=$root/* |
|
67 | 67 | rcoll=$root/** |
|
68 | star=* | |
|
69 | starstar=** | |
|
68 | 70 | EOF |
|
69 | 71 | |
|
70 | 72 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ |
@@ -46,6 +46,15 b' 200 Script output follows' | |||
|
46 | 46 | /rcoll/b/ |
|
47 | 47 | /rcoll/b/d/ |
|
48 | 48 | /rcoll/c/ |
|
49 | /star/webdir/a/ | |
|
50 | /star/webdir/a/.hg/patches/ | |
|
51 | /star/webdir/b/ | |
|
52 | /star/webdir/c/ | |
|
53 | /starstar/webdir/a/ | |
|
54 | /starstar/webdir/a/.hg/patches/ | |
|
55 | /starstar/webdir/b/ | |
|
56 | /starstar/webdir/b/d/ | |
|
57 | /starstar/webdir/c/ | |
|
49 | 58 | |
|
50 | 59 | 200 Script output follows |
|
51 | 60 | |
@@ -165,6 +174,78 b' 200 Script output follows' | |||
|
165 | 174 | <td class="indexlinks"></td> |
|
166 | 175 | </tr> |
|
167 | 176 | |
|
177 | <tr class="parity1"> | |
|
178 | <td><a href="/star/webdir/a/?style=paper">star/webdir/a</a></td> | |
|
179 | <td>unknown</td> | |
|
180 | <td>Foo Bar <foo.bar@example.com></td> | |
|
181 | <td class="age">seconds ago</td> | |
|
182 | <td class="indexlinks"></td> | |
|
183 | </tr> | |
|
184 | ||
|
185 | <tr class="parity0"> | |
|
186 | <td><a href="/star/webdir/a/.hg/patches/?style=paper">star/webdir/a/.hg/patches</a></td> | |
|
187 | <td>unknown</td> | |
|
188 | <td>Foo Bar <foo.bar@example.com></td> | |
|
189 | <td class="age">seconds ago</td> | |
|
190 | <td class="indexlinks"></td> | |
|
191 | </tr> | |
|
192 | ||
|
193 | <tr class="parity1"> | |
|
194 | <td><a href="/star/webdir/b/?style=paper">star/webdir/b</a></td> | |
|
195 | <td>unknown</td> | |
|
196 | <td>Foo Bar <foo.bar@example.com></td> | |
|
197 | <td class="age">seconds ago</td> | |
|
198 | <td class="indexlinks"></td> | |
|
199 | </tr> | |
|
200 | ||
|
201 | <tr class="parity0"> | |
|
202 | <td><a href="/star/webdir/c/?style=paper">star/webdir/c</a></td> | |
|
203 | <td>unknown</td> | |
|
204 | <td>Foo Bar <foo.bar@example.com></td> | |
|
205 | <td class="age">seconds ago</td> | |
|
206 | <td class="indexlinks"></td> | |
|
207 | </tr> | |
|
208 | ||
|
209 | <tr class="parity1"> | |
|
210 | <td><a href="/starstar/webdir/a/?style=paper">starstar/webdir/a</a></td> | |
|
211 | <td>unknown</td> | |
|
212 | <td>Foo Bar <foo.bar@example.com></td> | |
|
213 | <td class="age">seconds ago</td> | |
|
214 | <td class="indexlinks"></td> | |
|
215 | </tr> | |
|
216 | ||
|
217 | <tr class="parity0"> | |
|
218 | <td><a href="/starstar/webdir/a/.hg/patches/?style=paper">starstar/webdir/a/.hg/patches</a></td> | |
|
219 | <td>unknown</td> | |
|
220 | <td>Foo Bar <foo.bar@example.com></td> | |
|
221 | <td class="age">seconds ago</td> | |
|
222 | <td class="indexlinks"></td> | |
|
223 | </tr> | |
|
224 | ||
|
225 | <tr class="parity1"> | |
|
226 | <td><a href="/starstar/webdir/b/?style=paper">starstar/webdir/b</a></td> | |
|
227 | <td>unknown</td> | |
|
228 | <td>Foo Bar <foo.bar@example.com></td> | |
|
229 | <td class="age">seconds ago</td> | |
|
230 | <td class="indexlinks"></td> | |
|
231 | </tr> | |
|
232 | ||
|
233 | <tr class="parity0"> | |
|
234 | <td><a href="/starstar/webdir/b/d/?style=paper">starstar/webdir/b/d</a></td> | |
|
235 | <td>unknown</td> | |
|
236 | <td>Foo Bar <foo.bar@example.com></td> | |
|
237 | <td class="age">seconds ago</td> | |
|
238 | <td class="indexlinks"></td> | |
|
239 | </tr> | |
|
240 | ||
|
241 | <tr class="parity1"> | |
|
242 | <td><a href="/starstar/webdir/c/?style=paper">starstar/webdir/c</a></td> | |
|
243 | <td>unknown</td> | |
|
244 | <td>Foo Bar <foo.bar@example.com></td> | |
|
245 | <td class="age">seconds ago</td> | |
|
246 | <td class="indexlinks"></td> | |
|
247 | </tr> | |
|
248 | ||
|
168 | 249 | </table> |
|
169 | 250 | </div> |
|
170 | 251 | </div> |
@@ -283,8 +283,17 b' hg revert --no-backup --rev tip a' | |||
|
283 | 283 | echo % cat a |
|
284 | 284 | cat a |
|
285 | 285 | |
|
286 | echo % clone | |
|
287 | cd .. | |
|
288 | ||
|
289 | echo % expansion in dest | |
|
290 | hg --quiet clone Test globalconf | |
|
291 | cat globalconf/a | |
|
292 | echo % no expansion in dest | |
|
293 | hg --quiet --config 'keyword.**=ignore' clone Test localconf | |
|
294 | cat localconf/a | |
|
295 | ||
|
286 | 296 | echo % clone to test incoming |
|
287 | cd .. | |
|
288 | 297 | hg clone -r1 Test Test-a |
|
289 | 298 | cd Test-a |
|
290 | 299 | cat <<EOF >> .hg/hgrc |
@@ -333,6 +333,17 b' expand $Id: a bb948857c743 Thu, 01 Jan 1' | |||
|
333 | 333 | do not process $Id: |
|
334 | 334 | xxx $ |
|
335 | 335 | $Xinfo: User Name <user@example.com>: firstline $ |
|
336 | % clone | |
|
337 | % expansion in dest | |
|
338 | expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $ | |
|
339 | do not process $Id: | |
|
340 | xxx $ | |
|
341 | $Xinfo: User Name <user@example.com>: firstline $ | |
|
342 | % no expansion in dest | |
|
343 | expand $Id$ | |
|
344 | do not process $Id: | |
|
345 | xxx $ | |
|
346 | $Xinfo$ | |
|
336 | 347 | % clone to test incoming |
|
337 | 348 | requesting all changes |
|
338 | 349 | adding changesets |
General Comments 0
You need to be logged in to leave comments.
Login now