merge with stable

This commit is contained in:
Matt Mackall 2011-07-12 16:27:03 -05:00
commit 107896d6aa
3 changed files with 55 additions and 10 deletions

View File

@ -81,6 +81,8 @@ class ciamsg(object):
n = self.ctx.node()
f = self.cia.repo.status(self.ctx.p1().node(), n)
url = self.url or ''
if url and url[-1] == '/':
url = url[:-1]
elems = []
for path in f[0]:
uri = '%s/diff/%s/%s' % (url, short(n), path)
@ -141,8 +143,10 @@ class ciamsg(object):
rev = '%d:%s' % (self.ctx.rev(), n)
log = saxutils.escape(self.logmsg())
url = self.url and '<url>%s/rev/%s</url>' % (saxutils.escape(self.url),
n) or ''
url = self.url
if url and url[-1] == '/':
url = url[:-1]
url = url and '<url>%s/rev/%s</url>' % (saxutils.escape(url), n) or ''
msg = """
<message>
@ -190,7 +194,8 @@ class hgcia(object):
self.emailfrom = self.ui.config('email', 'from')
self.dryrun = self.ui.configbool('cia', 'test')
self.url = self.ui.config('web', 'baseurl')
self.stripcount = int(self.ui.config('cia', 'strip', 0))
# Default to -1 for backward compatibility
self.stripcount = int(self.ui.config('cia', 'strip', -1))
self.root = self.strip(self.repo.root)
style = self.ui.config('cia', 'style')
@ -208,6 +213,8 @@ class hgcia(object):
path = util.pconvert(path)
count = self.stripcount
if count < 0:
return ''
while count > 0:
c = path.find('/')
if c == -1:

View File

@ -217,7 +217,7 @@ def ancestorspec(repo, subset, x, n):
"""
try:
n = int(n[1])
except ValueError:
except (TypeError, ValueError):
raise error.ParseError(_("~ expects a number"))
ps = set()
cl = repo.changelog
@ -521,7 +521,7 @@ def limit(repo, subset, x):
try:
# i18n: "limit" is a keyword
lim = int(getstring(l[1], _("limit requires a number")))
except ValueError:
except (TypeError, ValueError):
# i18n: "limit" is a keyword
raise error.ParseError(_("limit expects a number"))
ss = set(subset)
@ -537,7 +537,7 @@ def last(repo, subset, x):
try:
# i18n: "last" is a keyword
lim = int(getstring(l[1], _("last requires a number")))
except ValueError:
except (TypeError, ValueError):
# i18n: "last" is a keyword
raise error.ParseError(_("last expects a number"))
ss = set(subset)
@ -676,7 +676,7 @@ def parentspec(repo, subset, x, n):
n = int(n[1])
if n not in (0, 1, 2):
raise ValueError
except ValueError:
except (TypeError, ValueError):
raise error.ParseError(_("^ expects a number 0, 1, or 2"))
ps = set()
cl = repo.changelog
@ -718,7 +718,7 @@ def rev(repo, subset, x):
try:
# i18n: "rev" is a keyword
l = int(getstring(l[0], _("rev requires a number")))
except ValueError:
except (TypeError, ValueError):
# i18n: "rev" is a keyword
raise error.ParseError(_("rev expects a number"))
return [r for r in subset if r == l]

View File

@ -46,8 +46,46 @@ Test the CIA extension
<author>test</author>
<version>0:e63c23eaa88a</version>
<log>foo</log>
<url>http://hgserver/$TESTTMP/cia/rev/e63c23eaa88a</url>
<files><file uri="http://hgserver/$TESTTMP/cia/file/e63c23eaa88a/foo" action="add">foo</file></files>
<url>http://hgserver/rev/e63c23eaa88a</url>
<files><file uri="http://hgserver/file/e63c23eaa88a/foo" action="add">foo</file></files>
</commit>
</body>
<timestamp>0</timestamp>
</message>
$ cat >> $HGRCPATH <<EOF
> strip = 0
> EOF
$ echo bar > bar
$ hg ci -Ambar
adding bar
$ hg push ../cia
pushing to ../cia
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
<message>
<generator>
<name>Mercurial (hgcia)</name>
<version>0.1</version>
<url>http://hg.kublai.com/mercurial/hgcia</url>
<user>testuser</user>
</generator>
<source>
<project>testproject</project>
<branch>default</branch>
</source>
<body>
<commit>
<author>test</author>
<version>1:c0c7cf58edc5</version>
<log>bar</log>
<url>http://hgserver/$TESTTMP/cia/rev/c0c7cf58edc5</url>
<files><file uri="http://hgserver/$TESTTMP/cia/file/c0c7cf58edc5/bar" action="add">bar</file></files>
</commit>
</body>
<timestamp>0</timestamp>