##// END OF EJS Templates
Merge with stable
Matt Mackall -
r11681:c5e555e0 merge default
parent child Browse files
Show More
@@ -108,7 +108,7 b" svnisodate = lambda x: util.datestr(x, '"
108 svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ')
108 svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ')
109
109
110 # make keyword tools accessible
110 # make keyword tools accessible
111 kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}
111 kwtools = {'templater': None, 'hgcmd': ''}
112
112
113
113
114 def _defaultkwmaps(ui):
114 def _defaultkwmaps(ui):
@@ -141,11 +141,10 b' class kwtemplater(object):'
141 provides keyword substitution functions.
141 provides keyword substitution functions.
142 '''
142 '''
143
143
144 def __init__(self, ui, repo):
144 def __init__(self, ui, repo, inc, exc):
145 self.ui = ui
145 self.ui = ui
146 self.repo = repo
146 self.repo = repo
147 self.match = match.match(repo.root, '', [],
147 self.match = match.match(repo.root, '', [], inc, exc)
148 kwtools['inc'], kwtools['exc'])
149 self.restrict = kwtools['hgcmd'] in restricted.split()
148 self.restrict = kwtools['hgcmd'] in restricted.split()
150 self.record = kwtools['hgcmd'] in recordcommands.split()
149 self.record = kwtools['hgcmd'] in recordcommands.split()
151
150
@@ -438,23 +437,15 b' def shrink(ui, repo, *pats, **opts):'
438
437
439
438
440 def uisetup(ui):
439 def uisetup(ui):
441 '''Collects [keyword] config in kwtools.
440 ''' Monkeypatches dispatch._parse to retrieve user command.'''
442 Monkeypatches dispatch._parse if needed.'''
443
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
441
450 if kwtools['inc']:
442 def kwdispatch_parse(orig, ui, args):
451 def kwdispatch_parse(orig, ui, args):
443 '''Monkeypatch dispatch._parse to obtain running hg command.'''
452 '''Monkeypatch dispatch._parse to obtain running hg command.'''
444 cmd, func, args, options, cmdoptions = orig(ui, args)
453 cmd, func, args, options, cmdoptions = orig(ui, args)
445 kwtools['hgcmd'] = cmd
454 kwtools['hgcmd'] = cmd
446 return cmd, func, args, options, cmdoptions
455 return cmd, func, args, options, cmdoptions
456
447
457 extensions.wrapfunction(dispatch, '_parse', kwdispatch_parse)
448 extensions.wrapfunction(dispatch, '_parse', kwdispatch_parse)
458
449
459 def reposetup(ui, repo):
450 def reposetup(ui, repo):
460 '''Sets up repo as kwrepo for keyword substitution.
451 '''Sets up repo as kwrepo for keyword substitution.
@@ -465,15 +456,23 b' def reposetup(ui, repo):'
465 Monkeypatches patch and webcommands.'''
456 Monkeypatches patch and webcommands.'''
466
457
467 try:
458 try:
468 if (not repo.local() or not kwtools['inc']
459 if (not repo.local() or kwtools['hgcmd'] in nokwcommands.split()
469 or kwtools['hgcmd'] in nokwcommands.split()
470 or '.hg' in util.splitpath(repo.root)
460 or '.hg' in util.splitpath(repo.root)
471 or repo._url.startswith('bundle:')):
461 or repo._url.startswith('bundle:')):
472 return
462 return
473 except AttributeError:
463 except AttributeError:
474 pass
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 class kwrepo(repo.__class__):
477 class kwrepo(repo.__class__):
479 def file(self, f):
478 def file(self, f):
@@ -262,7 +262,7 b' class cmdalias(object):'
262 if self.shadows:
262 if self.shadows:
263 ui.debug("alias '%s' shadows command\n" % self.name)
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 def addaliases(ui, cmdtable):
267 def addaliases(ui, cmdtable):
268 # aliases are processed after extensions have been loaded, so they
268 # aliases are processed after extensions have been loaded, so they
@@ -380,7 +380,12 b' def _dispatch(ui, args):'
380 os.chdir(cwd[-1])
380 os.chdir(cwd[-1])
381
381
382 # read the local repository .hgrc into a local ui object
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 if not path:
389 if not path:
385 lui = ui
390 lui = ui
386 else:
391 else:
@@ -32,7 +32,7 b' def findrepos(paths):'
32 except KeyError:
32 except KeyError:
33 repos.append((prefix, root))
33 repos.append((prefix, root))
34 continue
34 continue
35 roothead = os.path.normpath(roothead)
35 roothead = os.path.normpath(os.path.abspath(roothead))
36 for path in util.walkrepos(roothead, followsym=True, recurse=recurse):
36 for path in util.walkrepos(roothead, followsym=True, recurse=recurse):
37 path = os.path.normpath(path)
37 path = os.path.normpath(path)
38 name = util.pconvert(path[len(roothead):]).strip('/')
38 name = util.pconvert(path[len(roothead):]).strip('/')
@@ -15,6 +15,7 b' dln = lognull --debug'
15 nousage = rollback
15 nousage = rollback
16 put = export -r 0 -o "\$FOO/%R.diff"
16 put = export -r 0 -o "\$FOO/%R.diff"
17 echo = !echo
17 echo = !echo
18 rt = root
18
19
19 [defaults]
20 [defaults]
20 mylog = -q
21 mylog = -q
@@ -68,3 +69,7 b' cat 0.diff'
68
69
69 echo '% shell aliases'
70 echo '% shell aliases'
70 hg echo foo
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 +foo
45 +foo
46 % shell aliases
46 % shell aliases
47 foo
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 "$TESTDIR/hghave" no-outer-repo || exit 80
4 "$TESTDIR/hghave" no-outer-repo || exit 80
5
5
6 dir=`pwd`
7
6 hg init a
8 hg init a
7 cd a
9 cd a
8 echo a > a
10 echo a > a
@@ -19,8 +21,12 b' cat = -r null'
19 EOF
21 EOF
20 hg cat a
22 hg cat a
21
23
24 echo '% working directory removed'
25 rm -rf $dir/a
26 hg --version
27
22 echo '% no repo'
28 echo '% no repo'
23 cd ..
29 cd $dir
24 hg cat
30 hg cat
25
31
26 exit 0
32 exit 0
@@ -33,5 +33,7 b' use "hg -v help cat" to show global opti'
33 % [defaults]
33 % [defaults]
34 a
34 a
35 a: No such file in rev 000000000000
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 % no repo
38 % no repo
37 abort: There is no Mercurial repository here (.hg not found)!
39 abort: There is no Mercurial repository here (.hg not found)!
@@ -60,34 +60,38 b' hg help showoptlist'
60 #### - user names in annotate
60 #### - user names in annotate
61 #### - file names in diffstat
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 #### add files
67 #### add files
64
68
65 touch $S
69 cp s $S
66 hg add $S
70 hg add $S
67 touch $M
71 cp m $M
68 hg add $M
72 hg add $M
69 touch $L
73 cp l $L
70 hg add $L
74 hg add $L
71
75
72 #### commit(1)
76 #### commit(1)
73
77
74 echo 'first line(1)' >> $S
78 echo 'first line(1)' >> s; cp s $S
75 echo 'first line(2)' >> $M
79 echo 'first line(2)' >> m; cp m $M
76 echo 'first line(3)' >> $L
80 echo 'first line(3)' >> l; cp l $L
77 hg commit -m 'first commit' -u $S -d "1000000 0"
81 hg commit -m 'first commit' -u $S -d "1000000 0"
78
82
79 #### commit(2)
83 #### commit(2)
80
84
81 echo 'second line(1)' >> $S
85 echo 'second line(1)' >> s; cp s $S
82 echo 'second line(2)' >> $M
86 echo 'second line(2)' >> m; cp m $M
83 echo 'second line(3)' >> $L
87 echo 'second line(3)' >> l; cp l $L
84 hg commit -m 'second commit' -u $M -d "1000000 0"
88 hg commit -m 'second commit' -u $M -d "1000000 0"
85
89
86 #### commit(3)
90 #### commit(3)
87
91
88 echo 'third line(1)' >> $S
92 echo 'third line(1)' >> s; cp s $S
89 echo 'third line(2)' >> $M
93 echo 'third line(2)' >> m; cp m $M
90 echo 'third line(3)' >> $L
94 echo 'third line(3)' >> l; cp l $L
91 hg commit -m 'third commit' -u $L -d "1000000 0"
95 hg commit -m 'third commit' -u $L -d "1000000 0"
92
96
93 #### check
97 #### check
@@ -65,6 +65,8 b' t/a/=$root/a'
65 b=$root/b
65 b=$root/b
66 coll=$root/*
66 coll=$root/*
67 rcoll=$root/**
67 rcoll=$root/**
68 star=*
69 starstar=**
68 EOF
70 EOF
69
71
70 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
72 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
@@ -46,6 +46,15 b' 200 Script output follows'
46 /rcoll/b/
46 /rcoll/b/
47 /rcoll/b/d/
47 /rcoll/b/d/
48 /rcoll/c/
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 200 Script output follows
59 200 Script output follows
51
60
@@ -165,6 +174,78 b' 200 Script output follows'
165 <td class="indexlinks"></td>
174 <td class="indexlinks"></td>
166 </tr>
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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
245 <td class="age">seconds ago</td>
246 <td class="indexlinks"></td>
247 </tr>
248
168 </table>
249 </table>
169 </div>
250 </div>
170 </div>
251 </div>
@@ -283,8 +283,17 b' hg revert --no-backup --rev tip a'
283 echo % cat a
283 echo % cat a
284 cat a
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 echo % clone to test incoming
296 echo % clone to test incoming
287 cd ..
288 hg clone -r1 Test Test-a
297 hg clone -r1 Test Test-a
289 cd Test-a
298 cd Test-a
290 cat <<EOF >> .hg/hgrc
299 cat <<EOF >> .hg/hgrc
@@ -333,6 +333,17 b' expand $Id: a bb948857c743 Thu, 01 Jan 1'
333 do not process $Id:
333 do not process $Id:
334 xxx $
334 xxx $
335 $Xinfo: User Name <user@example.com>: firstline $
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 % clone to test incoming
347 % clone to test incoming
337 requesting all changes
348 requesting all changes
338 adding changesets
349 adding changesets
General Comments 0
You need to be logged in to leave comments. Login now