Mercurial > public > mercurial-scm > hg-stable
diff hgext/hgcia.py @ 14850:a95242af945c stable
hgcia: Set default value of strip to -1 (issue2891)
For backward compatibility the root path of the repository is not
displayed unless the user has specified an explicit strip value.
author | C?dric Krier <ced@b2ck.com> |
---|---|
date | Sat, 09 Jul 2011 09:44:15 +0200 |
parents | c322890b03e6 |
children | 55a85a55f020 |
line wrap: on
line diff
--- a/hgext/hgcia.py Thu Jul 07 10:32:30 2011 +0200 +++ b/hgext/hgcia.py Sat Jul 09 09:44:15 2011 +0200 @@ -81,6 +81,8 @@ 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 @@ 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 @@ 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 @@ path = util.pconvert(path) count = self.stripcount + if count < 0: + return '' while count > 0: c = path.find('/') if c == -1: