--- a/contrib/check-code.py Fri Jul 30 10:07:46 2010 +0900
+++ b/contrib/check-code.py Sat Jul 31 11:05:11 2010 +0900
@@ -82,6 +82,7 @@
(r'\w[+/*\-<>]\w', "missing whitespace in expression"),
(r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
(r'.{85}', "line too long"),
+ (r'.{81}', "warning: line over 80 characters"),
(r'[^\n]\Z', "no trailing newline"),
# (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
# (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
--- a/contrib/perf.py Fri Jul 30 10:07:46 2010 +0900
+++ b/contrib/perf.py Sat Jul 31 11:05:11 2010 +0900
@@ -133,6 +133,16 @@
title = 'diffopts: %s' % (diffopt and ('-' + diffopt) or 'none')
timer(d, title)
+def perfrevlog(ui, repo, file_, **opts):
+ from mercurial import revlog
+ dist = opts['dist']
+ def d():
+ r = revlog.revlog(lambda fn: open(fn, 'rb'), file_)
+ for x in xrange(0, len(r), dist):
+ r.revision(r.node(x))
+
+ timer(d)
+
cmdtable = {
'perflookup': (perflookup, []),
'perfparents': (perfparents, []),
@@ -149,4 +159,5 @@
[('', 'rename', False, 'ask log to follow renames')]),
'perftemplating': (perftemplating, []),
'perfdiffwd': (perfdiffwd, []),
+ 'perfrevlog': (perfrevlog, [('d', 'dist', 100, 'distance between the revisions')],"[INDEXFILE]"),
}
--- a/hgext/convert/filemap.py Fri Jul 30 10:07:46 2010 +0900
+++ b/hgext/convert/filemap.py Sat Jul 31 11:05:11 2010 +0900
@@ -33,10 +33,20 @@
def parse(self, path):
errs = 0
def check(name, mapping, listname):
+ if not name:
+ self.ui.warn(_('%s:%d: path to %s is missing\n') %
+ (lex.infile, lex.lineno, listname))
+ return 1
if name in mapping:
self.ui.warn(_('%s:%d: %r already in %s list\n') %
(lex.infile, lex.lineno, name, listname))
return 1
+ if (name.startswith('/') or
+ name.endswith('/') or
+ '//' in name):
+ self.ui.warn(_('%s:%d: superfluous / in %s %r\n') %
+ (lex.infile, lex.lineno, listname, name))
+ return 1
return 0
lex = shlex.shlex(open(path), path, True)
lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?'
@@ -298,7 +308,9 @@
self.origparents[rev] = parents
- if len(mparents) < 2 and not self.wanted(rev, wp):
+ closed = 'close' in self.commits[rev].extra
+
+ if len(mparents) < 2 and not closed and not self.wanted(rev, wp):
# We don't want this revision.
# Update our state and tell the convert process to map this
# revision to the same revision its parent as mapped to.
--- a/hgext/convert/hg.py Fri Jul 30 10:07:46 2010 +0900
+++ b/hgext/convert/hg.py Sat Jul 31 11:05:11 2010 +0900
@@ -175,7 +175,8 @@
if self.filemapmode and nparents == 1:
man = self.repo.manifest
mnode = self.repo.changelog.read(bin(p2))[0]
- if not man.cmp(m1node, man.revision(mnode)):
+ closed = 'close' in commit.extra
+ if not closed and not man.cmp(m1node, man.revision(mnode)):
self.ui.status(_("filtering out empty revision\n"))
self.repo.rollback()
return parent
--- a/hgext/inotify/linux/_inotify.c Fri Jul 30 10:07:46 2010 +0900
+++ b/hgext/inotify/linux/_inotify.c Sat Jul 31 11:05:11 2010 +0900
@@ -343,7 +343,6 @@
{
int cookie = evt->cookie == Py_None ? -1 : PyInt_AsLong(evt->cookie);
PyObject *ret = NULL, *pymasks = NULL, *pymask = NULL;
- char *maskstr;
PyObject *tuple = NULL, *formatstr = NULL;
pymasks = decode_mask(PyInt_AsLong(evt->mask));
--- a/hgext/keyword.py Fri Jul 30 10:07:46 2010 +0900
+++ b/hgext/keyword.py Sat Jul 31 11:05:11 2010 +0900
@@ -108,7 +108,7 @@
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 @@
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 uisetup(ui):
- '''Collects [keyword] config in kwtools.
- Monkeypatches dispatch._parse if needed.'''
-
- for pat, opt in ui.configitems('keyword'):
- if opt != 'ignore':
- kwtools['inc'].append(pat)
- else:
- kwtools['exc'].append(pat)
+ ''' Monkeypatches dispatch._parse to retrieve user command.'''
- 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
+ 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 @@
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):
--- a/mercurial/commands.py Fri Jul 30 10:07:46 2010 +0900
+++ b/mercurial/commands.py Sat Jul 31 11:05:11 2010 +0900
@@ -3650,6 +3650,8 @@
for n in names:
if n in ['tip', '.', 'null']:
raise util.Abort(_('the name \'%s\' is reserved') % n)
+ if not n:
+ raise util.Abort(_('tag names cannot consist entirely of whitespace'))
if opts.get('rev') and opts.get('remove'):
raise util.Abort(_("--rev and --remove are incompatible"))
if opts.get('rev'):
--- a/mercurial/dispatch.py Fri Jul 30 10:07:46 2010 +0900
+++ b/mercurial/dispatch.py Sat Jul 31 11:05:11 2010 +0900
@@ -223,6 +223,18 @@
cmd = args.pop(0)
args = map(util.expandpath, args)
+ for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
+ if _earlygetopt([invalidarg], args):
+ def fn(ui, *args):
+ ui.warn(_("error in definition for alias '%s': %s may only "
+ "be given on the command line\n")
+ % (self.name, invalidarg))
+ return 1
+
+ self.fn = fn
+ self.badalias = True
+ return
+
try:
tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
if len(tableentry) > 2:
@@ -262,7 +274,7 @@
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 +392,12 @@
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:
--- a/mercurial/hgweb/hgwebdir_mod.py Fri Jul 30 10:07:46 2010 +0900
+++ b/mercurial/hgweb/hgwebdir_mod.py Sat Jul 31 11:05:11 2010 +0900
@@ -32,7 +32,7 @@
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('/')
--- a/mercurial/revlog.py Fri Jul 30 10:07:46 2010 +0900
+++ b/mercurial/revlog.py Sat Jul 31 11:05:11 2010 +0900
@@ -533,6 +533,8 @@
return self.index[rev][1]
def base(self, rev):
return self.index[rev][3]
+ def flags(self, rev):
+ return self.index[rev][0] & 0xFFFF
def size(self, rev):
"""return the length of the uncompressed text for a given revision"""
@@ -1020,9 +1022,9 @@
base = self.base(rev)
# check rev flags
- if self.index[rev][0] & 0xFFFF:
+ if self.flags(rev):
raise RevlogError(_('incompatible revision flag %x') %
- (self.index[rev][0] & 0xFFFF))
+ (self.flags(rev)))
# do we have useful data cached?
if self._cache and self._cache[1] >= base and self._cache[1] < rev:
--- a/tests/test-alias Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-alias Sat Jul 31 11:05:11 2010 +0900
@@ -8,6 +8,10 @@
ambiguous = s
recursive = recursive
nodefinition =
+no--cwd = status --cwd elsewhere
+no-R = status -R elsewhere
+no--repo = status --repo elsewhere
+no--repository = status --repository elsewhere
mylog = log
lognull = log -r null
shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
@@ -15,6 +19,7 @@
nousage = rollback
put = export -r 0 -o "\$FOO/%R.diff"
echo = !echo
+rt = root
[defaults]
mylog = -q
@@ -41,6 +46,16 @@
hg nodef
hg help nodef
+echo '% invalid options'
+hg no--cwd
+hg help no--cwd
+hg no-R
+hg help no-R
+hg no--repo
+hg help no--repo
+hg no--repository
+hg help no--repository
+
cd alias
echo '% no usage'
@@ -68,3 +83,7 @@
echo '% shell aliases'
hg echo foo
+echo '% invalid arguments'
+hg rt foo
+
+exit 0
--- a/tests/test-alias.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-alias.out Sat Jul 31 11:05:11 2010 +0900
@@ -11,6 +11,15 @@
% no definition
no definition for alias 'nodefinition'
no definition for alias 'nodefinition'
+% invalid options
+error in definition for alias 'no--cwd': --cwd may only be given on the command line
+error in definition for alias 'no--cwd': --cwd may only be given on the command line
+error in definition for alias 'no-R': -R may only be given on the command line
+error in definition for alias 'no-R': -R may only be given on the command line
+error in definition for alias 'no--repo': --repo may only be given on the command line
+error in definition for alias 'no--repo': --repo may only be given on the command line
+error in definition for alias 'no--repository': --repository may only be given on the command line
+error in definition for alias 'no--repository': --repository may only be given on the command line
% no usage
no rollback information available
adding foo
@@ -45,3 +54,16 @@
+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
--- a/tests/test-convert-filemap Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-convert-filemap Sat Jul 31 11:05:11 2010 +0900
@@ -128,3 +128,14 @@
hg --cwd source cat copied
echo 'copied2:'
hg --cwd renames.repo cat copied2
+
+echo % filemap errors
+cat > errors.fmap <<EOF
+include dir/ # beware that comments changes error line numbers!
+exclude /dir
+rename dir//dir /dir//dir/ "out of sync"
+include
+EOF
+hg -q convert --filemap errors.fmap source errors.repo
+
+true # happy ending
--- a/tests/test-convert-filemap.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-convert-filemap.out Sat Jul 31 11:05:11 2010 +0900
@@ -157,3 +157,11 @@
foo
copied2:
foo
+% filemap errors
+errors.fmap:1: superfluous / in exclude 'dir/'
+errors.fmap:3: superfluous / in include '/dir'
+errors.fmap:3: superfluous / in rename '/dir'
+errors.fmap:3: superfluous / in exclude 'dir//dir'
+errors.fmap:4: unknown directive 'out of sync'
+errors.fmap:5: path to exclude is missing
+abort: errors in filemap
--- a/tests/test-convert-hg-source Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-convert-hg-source Sat Jul 31 11:05:11 2010 +0900
@@ -32,6 +32,10 @@
chmod +x baz
hg ci -m 'mark baz executable' -d '5 0'
+hg branch foo
+hg ci -m 'branch foo' -d '6 0'
+hg ci --close-branch -m 'close' -d '7 0'
+
cd ..
hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
cd new
--- a/tests/test-convert-hg-source.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-convert-hg-source.out Sat Jul 31 11:05:11 2010 +0900
@@ -7,16 +7,19 @@
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
created new head
+marked working directory as branch foo
initializing destination new repository
scanning source...
sorting...
converting...
-5 add foo bar
-4 change foo
-3 make bar and baz copies of foo
-2 merge local copy
-1 merge remote copy
-0 mark baz executable
+7 add foo bar
+6 change foo
+5 make bar and baz copies of foo
+4 merge local copy
+3 merge remote copy
+2 mark baz executable
+1 branch foo
+0 close
comparing with ../orig
searching for changes
no changes found
--- a/tests/test-dispatch Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-dispatch Sat Jul 31 11:05:11 2010 +0900
@@ -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 @@
EOF
hg cat a
+echo '% working directory removed'
+rm -rf $dir/a
+hg --version
+
echo '% no repo'
-cd ..
+cd $dir
hg cat
exit 0
--- a/tests/test-dispatch.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-dispatch.out Sat Jul 31 11:05:11 2010 +0900
@@ -33,5 +33,7 @@
% [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)!
--- a/tests/test-encoding-align Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-encoding-align Sat Jul 31 11:05:11 2010 +0900
@@ -60,34 +60,38 @@
#### - 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
--- a/tests/test-hgwebdir Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-hgwebdir Sat Jul 31 11:05:11 2010 +0900
@@ -65,6 +65,8 @@
b=$root/b
coll=$root/*
rcoll=$root/**
+star=*
+starstar=**
EOF
hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
--- a/tests/test-hgwebdir.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-hgwebdir.out Sat Jul 31 11:05:11 2010 +0900
@@ -46,6 +46,15 @@
/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 @@
<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>
--- a/tests/test-keyword Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-keyword Sat Jul 31 11:05:11 2010 +0900
@@ -283,8 +283,17 @@
echo % cat a
cat a
+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
-cd ..
hg clone -r1 Test Test-a
cd Test-a
cat <<EOF >> .hg/hgrc
--- a/tests/test-keyword.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-keyword.out Sat Jul 31 11:05:11 2010 +0900
@@ -333,6 +333,17 @@
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
--- a/tests/test-tag Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-tag Sat Jul 31 11:05:11 2010 +0900
@@ -7,6 +7,9 @@
hg add a
hg commit -m "test" -d "1000000 0"
hg history
+
+hg tag ' '
+
hg tag -d "1000000 0" "bleah"
hg history
--- a/tests/test-tag.out Fri Jul 30 10:07:46 2010 +0900
+++ b/tests/test-tag.out Sat Jul 31 11:05:11 2010 +0900
@@ -4,6 +4,7 @@
date: Mon Jan 12 13:46:40 1970 +0000
summary: test
+abort: tag names cannot consist entirely of whitespace
changeset: 1:3ecf002a1c57
tag: tip
user: test