summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm/adapters/mercurial
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-10-24 09:32:06 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-10-24 09:32:06 +0000
commited87fc4e66e29f10d159d3c17340615c46fedc0b (patch)
treecfe29d73e482f233851f6d6364e549a1bc83f470 /lib/redmine/scm/adapters/mercurial
parenta6d3409a5a0c42de30fd112f9f63c9522ff62833 (diff)
downloadredmine-ed87fc4e66e29f10d159d3c17340615c46fedc0b.tar.gz
redmine-ed87fc4e66e29f10d159d3c17340615c46fedc0b.zip
scm: mercurial: switch rev parameter of extension rhlog() if above Mercurial 1.6 or not (#9465)
On Mercurial 1.5, following error raises. <pre> hg --config extensions.redminehelper=lib/redmine/scm/adapters/mercurial/redminehelper.py \ --rhbranch default --from default --to 0 abort: unknown revision '"default"'! </pre> git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7641 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm/adapters/mercurial')
-rw-r--r--lib/redmine/scm/adapters/mercurial/redminehelper.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/redmine/scm/adapters/mercurial/redminehelper.py b/lib/redmine/scm/adapters/mercurial/redminehelper.py
index eaba17e1f..6eed7ed0a 100644
--- a/lib/redmine/scm/adapters/mercurial/redminehelper.py
+++ b/lib/redmine/scm/adapters/mercurial/redminehelper.py
@@ -46,7 +46,7 @@ Output example of rhmanifest::
</rhmanifest>
"""
import re, time, cgi, urllib
-from mercurial import cmdutil, commands, node, error
+from mercurial import cmdutil, commands, node, error, hg
_x = cgi.escape
_u = lambda s: cgi.escape(urllib.quote(s))
@@ -146,7 +146,10 @@ def rhlog(ui, repo, *pats, **opts):
bra = urllib.unquote_plus(opts.pop('rhbranch', None))
from_rev = from_rev.replace('"', '\\"')
to_rev = to_rev.replace('"', '\\"')
- opts['rev'] = ['"%s":"%s"' % (from_rev, to_rev)]
+ if hg.util.version() >= '1.6':
+ opts['rev'] = ['"%s":"%s"' % (from_rev, to_rev)]
+ else:
+ opts['rev'] = ['%s:%s' % (from_rev, to_rev)]
opts['branch'] = [bra]
return commands.log(ui, repo, *map(urllib.unquote_plus, pats), **opts)