mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
Merge with stable
This commit is contained in:
commit
671535ddb7
@ -108,7 +108,7 @@ svnisodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
|
||||
svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ')
|
||||
|
||||
# make keyword tools accessible
|
||||
kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}
|
||||
kwtools = {'templater': None, 'hgcmd': ''}
|
||||
|
||||
|
||||
def _defaultkwmaps(ui):
|
||||
@ -141,11 +141,10 @@ class kwtemplater(object):
|
||||
provides keyword substitution functions.
|
||||
'''
|
||||
|
||||
def __init__(self, ui, repo):
|
||||
def __init__(self, ui, repo, inc, exc):
|
||||
self.ui = ui
|
||||
self.repo = repo
|
||||
self.match = match.match(repo.root, '', [],
|
||||
kwtools['inc'], kwtools['exc'])
|
||||
self.match = match.match(repo.root, '', [], inc, exc)
|
||||
self.restrict = kwtools['hgcmd'] in restricted.split()
|
||||
self.record = kwtools['hgcmd'] in recordcommands.split()
|
||||
|
||||
@ -438,23 +437,15 @@ def shrink(ui, repo, *pats, **opts):
|
||||
|
||||
|
||||
def uisetup(ui):
|
||||
'''Collects [keyword] config in kwtools.
|
||||
Monkeypatches dispatch._parse if needed.'''
|
||||
''' Monkeypatches dispatch._parse to retrieve user command.'''
|
||||
|
||||
for pat, opt in ui.configitems('keyword'):
|
||||
if opt != 'ignore':
|
||||
kwtools['inc'].append(pat)
|
||||
else:
|
||||
kwtools['exc'].append(pat)
|
||||
def kwdispatch_parse(orig, ui, args):
|
||||
'''Monkeypatch dispatch._parse to obtain running hg command.'''
|
||||
cmd, func, args, options, cmdoptions = orig(ui, args)
|
||||
kwtools['hgcmd'] = cmd
|
||||
return cmd, func, args, options, cmdoptions
|
||||
|
||||
if kwtools['inc']:
|
||||
def kwdispatch_parse(orig, ui, args):
|
||||
'''Monkeypatch dispatch._parse to obtain running hg command.'''
|
||||
cmd, func, args, options, cmdoptions = orig(ui, args)
|
||||
kwtools['hgcmd'] = cmd
|
||||
return cmd, func, args, options, cmdoptions
|
||||
|
||||
extensions.wrapfunction(dispatch, '_parse', kwdispatch_parse)
|
||||
extensions.wrapfunction(dispatch, '_parse', kwdispatch_parse)
|
||||
|
||||
def reposetup(ui, repo):
|
||||
'''Sets up repo as kwrepo for keyword substitution.
|
||||
@ -465,15 +456,23 @@ def reposetup(ui, repo):
|
||||
Monkeypatches patch and webcommands.'''
|
||||
|
||||
try:
|
||||
if (not repo.local() or not kwtools['inc']
|
||||
or kwtools['hgcmd'] in nokwcommands.split()
|
||||
if (not repo.local() or kwtools['hgcmd'] in nokwcommands.split()
|
||||
or '.hg' in util.splitpath(repo.root)
|
||||
or repo._url.startswith('bundle:')):
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
kwtools['templater'] = kwt = kwtemplater(ui, repo)
|
||||
inc, exc = [], ['.hg*']
|
||||
for pat, opt in ui.configitems('keyword'):
|
||||
if opt != 'ignore':
|
||||
inc.append(pat)
|
||||
else:
|
||||
exc.append(pat)
|
||||
if not inc:
|
||||
return
|
||||
|
||||
kwtools['templater'] = kwt = kwtemplater(ui, repo, inc, exc)
|
||||
|
||||
class kwrepo(repo.__class__):
|
||||
def file(self, f):
|
||||
|
@ -262,7 +262,7 @@ class cmdalias(object):
|
||||
if self.shadows:
|
||||
ui.debug("alias '%s' shadows command\n" % self.name)
|
||||
|
||||
return self.fn(ui, *args, **opts)
|
||||
return util.checksignature(self.fn)(ui, *args, **opts)
|
||||
|
||||
def addaliases(ui, cmdtable):
|
||||
# aliases are processed after extensions have been loaded, so they
|
||||
@ -380,7 +380,12 @@ def _dispatch(ui, args):
|
||||
os.chdir(cwd[-1])
|
||||
|
||||
# read the local repository .hgrc into a local ui object
|
||||
path = cmdutil.findrepo(os.getcwd()) or ""
|
||||
try:
|
||||
wd = os.getcwd()
|
||||
except OSError, e:
|
||||
raise util.Abort(_("error getting current working directory: %s") %
|
||||
e.strerror)
|
||||
path = cmdutil.findrepo(wd) or ""
|
||||
if not path:
|
||||
lui = ui
|
||||
else:
|
||||
|
@ -32,7 +32,7 @@ def findrepos(paths):
|
||||
except KeyError:
|
||||
repos.append((prefix, root))
|
||||
continue
|
||||
roothead = os.path.normpath(roothead)
|
||||
roothead = os.path.normpath(os.path.abspath(roothead))
|
||||
for path in util.walkrepos(roothead, followsym=True, recurse=recurse):
|
||||
path = os.path.normpath(path)
|
||||
name = util.pconvert(path[len(roothead):]).strip('/')
|
||||
|
@ -15,6 +15,7 @@ dln = lognull --debug
|
||||
nousage = rollback
|
||||
put = export -r 0 -o "\$FOO/%R.diff"
|
||||
echo = !echo
|
||||
rt = root
|
||||
|
||||
[defaults]
|
||||
mylog = -q
|
||||
@ -68,3 +69,7 @@ cat 0.diff
|
||||
|
||||
echo '% shell aliases'
|
||||
hg echo foo
|
||||
echo '% invalid arguments'
|
||||
hg rt foo
|
||||
|
||||
exit 0
|
||||
|
@ -45,3 +45,16 @@ diff -r 000000000000 -r e63c23eaa88a foo
|
||||
+foo
|
||||
% shell aliases
|
||||
foo
|
||||
% invalid arguments
|
||||
hg rt: invalid arguments
|
||||
hg rt
|
||||
|
||||
alias for: hg root
|
||||
|
||||
print the root (top) of the current working directory
|
||||
|
||||
Print the root directory of the current repository.
|
||||
|
||||
Returns 0 on success.
|
||||
|
||||
use "hg -v help rt" to show global options
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
"$TESTDIR/hghave" no-outer-repo || exit 80
|
||||
|
||||
dir=`pwd`
|
||||
|
||||
hg init a
|
||||
cd a
|
||||
echo a > a
|
||||
@ -19,8 +21,12 @@ cat = -r null
|
||||
EOF
|
||||
hg cat a
|
||||
|
||||
echo '% working directory removed'
|
||||
rm -rf $dir/a
|
||||
hg --version
|
||||
|
||||
echo '% no repo'
|
||||
cd ..
|
||||
cd $dir
|
||||
hg cat
|
||||
|
||||
exit 0
|
||||
|
@ -33,5 +33,7 @@ use "hg -v help cat" to show global options
|
||||
% [defaults]
|
||||
a
|
||||
a: No such file in rev 000000000000
|
||||
% working directory removed
|
||||
abort: error getting current working directory: No such file or directory
|
||||
% no repo
|
||||
abort: There is no Mercurial repository here (.hg not found)!
|
||||
|
@ -60,34 +60,38 @@ hg help showoptlist
|
||||
#### - user names in annotate
|
||||
#### - file names in diffstat
|
||||
|
||||
rm -f s; touch s
|
||||
rm -f m; touch m
|
||||
rm -f l; touch l
|
||||
|
||||
#### add files
|
||||
|
||||
touch $S
|
||||
cp s $S
|
||||
hg add $S
|
||||
touch $M
|
||||
cp m $M
|
||||
hg add $M
|
||||
touch $L
|
||||
cp l $L
|
||||
hg add $L
|
||||
|
||||
#### commit(1)
|
||||
|
||||
echo 'first line(1)' >> $S
|
||||
echo 'first line(2)' >> $M
|
||||
echo 'first line(3)' >> $L
|
||||
echo 'first line(1)' >> s; cp s $S
|
||||
echo 'first line(2)' >> m; cp m $M
|
||||
echo 'first line(3)' >> l; cp l $L
|
||||
hg commit -m 'first commit' -u $S -d "1000000 0"
|
||||
|
||||
#### commit(2)
|
||||
|
||||
echo 'second line(1)' >> $S
|
||||
echo 'second line(2)' >> $M
|
||||
echo 'second line(3)' >> $L
|
||||
echo 'second line(1)' >> s; cp s $S
|
||||
echo 'second line(2)' >> m; cp m $M
|
||||
echo 'second line(3)' >> l; cp l $L
|
||||
hg commit -m 'second commit' -u $M -d "1000000 0"
|
||||
|
||||
#### commit(3)
|
||||
|
||||
echo 'third line(1)' >> $S
|
||||
echo 'third line(2)' >> $M
|
||||
echo 'third line(3)' >> $L
|
||||
echo 'third line(1)' >> s; cp s $S
|
||||
echo 'third line(2)' >> m; cp m $M
|
||||
echo 'third line(3)' >> l; cp l $L
|
||||
hg commit -m 'third commit' -u $L -d "1000000 0"
|
||||
|
||||
#### check
|
||||
|
@ -65,6 +65,8 @@ t/a/=$root/a
|
||||
b=$root/b
|
||||
coll=$root/*
|
||||
rcoll=$root/**
|
||||
star=*
|
||||
starstar=**
|
||||
EOF
|
||||
|
||||
hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
|
||||
|
@ -46,6 +46,15 @@ error: repository c not found
|
||||
/rcoll/b/
|
||||
/rcoll/b/d/
|
||||
/rcoll/c/
|
||||
/star/webdir/a/
|
||||
/star/webdir/a/.hg/patches/
|
||||
/star/webdir/b/
|
||||
/star/webdir/c/
|
||||
/starstar/webdir/a/
|
||||
/starstar/webdir/a/.hg/patches/
|
||||
/starstar/webdir/b/
|
||||
/starstar/webdir/b/d/
|
||||
/starstar/webdir/c/
|
||||
|
||||
200 Script output follows
|
||||
|
||||
@ -165,6 +174,78 @@ error: repository c not found
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity1">
|
||||
<td><a href="/star/webdir/a/?style=paper">star/webdir/a</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity0">
|
||||
<td><a href="/star/webdir/a/.hg/patches/?style=paper">star/webdir/a/.hg/patches</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity1">
|
||||
<td><a href="/star/webdir/b/?style=paper">star/webdir/b</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity0">
|
||||
<td><a href="/star/webdir/c/?style=paper">star/webdir/c</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity1">
|
||||
<td><a href="/starstar/webdir/a/?style=paper">starstar/webdir/a</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity0">
|
||||
<td><a href="/starstar/webdir/a/.hg/patches/?style=paper">starstar/webdir/a/.hg/patches</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity1">
|
||||
<td><a href="/starstar/webdir/b/?style=paper">starstar/webdir/b</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity0">
|
||||
<td><a href="/starstar/webdir/b/d/?style=paper">starstar/webdir/b/d</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
<tr class="parity1">
|
||||
<td><a href="/starstar/webdir/c/?style=paper">starstar/webdir/c</a></td>
|
||||
<td>unknown</td>
|
||||
<td>Foo Bar <foo.bar@example.com></td>
|
||||
<td class="age">seconds ago</td>
|
||||
<td class="indexlinks"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -283,8 +283,17 @@ hg revert --no-backup --rev tip a
|
||||
echo % cat a
|
||||
cat a
|
||||
|
||||
echo % clone to test incoming
|
||||
echo % clone
|
||||
cd ..
|
||||
|
||||
echo % expansion in dest
|
||||
hg --quiet clone Test globalconf
|
||||
cat globalconf/a
|
||||
echo % no expansion in dest
|
||||
hg --quiet --config 'keyword.**=ignore' clone Test localconf
|
||||
cat localconf/a
|
||||
|
||||
echo % clone to test incoming
|
||||
hg clone -r1 Test Test-a
|
||||
cd Test-a
|
||||
cat <<EOF >> .hg/hgrc
|
||||
|
@ -333,6 +333,17 @@ expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
||||
do not process $Id:
|
||||
xxx $
|
||||
$Xinfo: User Name <user@example.com>: firstline $
|
||||
% clone
|
||||
% expansion in dest
|
||||
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
||||
do not process $Id:
|
||||
xxx $
|
||||
$Xinfo: User Name <user@example.com>: firstline $
|
||||
% no expansion in dest
|
||||
expand $Id$
|
||||
do not process $Id:
|
||||
xxx $
|
||||
$Xinfo$
|
||||
% clone to test incoming
|
||||
requesting all changes
|
||||
adding changesets
|
||||
|
Loading…
Reference in New Issue
Block a user