summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2017-02-05 05:55:03 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2017-02-05 05:55:03 +0000
commitb8ab16b448ec7781c9a66ce19fa154820bbe2e67 (patch)
tree075f02b3f597133a754e74291d376ccffbb1d1ea
parente2ff2687f83d028682e9d448a1ac35ef800b31cd (diff)
downloadredmine-b8ab16b448ec7781c9a66ce19fa154820bbe2e67.tar.gz
redmine-b8ab16b448ec7781c9a66ce19fa154820bbe2e67.zip
Merged r16329 from trunk to 3.2-stable (#24999)
Mercurial 4.1 compatibility. git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16331 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/scm/adapters/mercurial/redminehelper.py81
1 files changed, 41 insertions, 40 deletions
diff --git a/lib/redmine/scm/adapters/mercurial/redminehelper.py b/lib/redmine/scm/adapters/mercurial/redminehelper.py
index b7d98a18f..27c30da2f 100644
--- a/lib/redmine/scm/adapters/mercurial/redminehelper.py
+++ b/lib/redmine/scm/adapters/mercurial/redminehelper.py
@@ -48,6 +48,9 @@ Output example of rhmanifest::
import re, time, cgi, urllib
from mercurial import cmdutil, commands, node, error, hg
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
_x = cgi.escape
_u = lambda s: cgi.escape(urllib.quote(s))
@@ -124,16 +127,30 @@ def _manifest(ui, repo, path, rev):
ui.write('</manifest>\n')
+@command('rhannotate',
+ [('r', 'rev', '', 'revision'),
+ ('u', 'user', None, 'list the author (long with -v)'),
+ ('n', 'number', None, 'list the revision number (default)'),
+ ('c', 'changeset', None, 'list the changeset'),
+ ],
+ 'hg rhannotate [-r REV] [-u] [-n] [-c] FILE...')
def rhannotate(ui, repo, *pats, **opts):
rev = urllib.unquote_plus(opts.pop('rev', None))
opts['rev'] = rev
return commands.annotate(ui, repo, *map(urllib.unquote_plus, pats), **opts)
+@command('rhcat',
+ [('r', 'rev', '', 'revision')],
+ 'hg rhcat ([-r REV] ...) FILE...')
def rhcat(ui, repo, file1, *pats, **opts):
rev = urllib.unquote_plus(opts.pop('rev', None))
opts['rev'] = rev
return commands.cat(ui, repo, urllib.unquote_plus(file1), *map(urllib.unquote_plus, pats), **opts)
+@command('rhdiff',
+ [('r', 'rev', [], 'revision'),
+ ('c', 'change', '', 'change made by revision')],
+ 'hg rhdiff ([-c REV] | [-r REV] ...) [FILE]...')
def rhdiff(ui, repo, *pats, **opts):
"""diff repository (or selected files)"""
change = opts.pop('change', None)
@@ -143,6 +160,26 @@ def rhdiff(ui, repo, *pats, **opts):
opts['nodates'] = True
return commands.diff(ui, repo, *map(urllib.unquote_plus, pats), **opts)
+@command('rhlog',
+ [
+ ('r', 'rev', [], 'show the specified revision'),
+ ('b', 'branch', [],
+ 'show changesets within the given named branch'),
+ ('l', 'limit', '',
+ 'limit number of changes displayed'),
+ ('d', 'date', '',
+ 'show revisions matching date spec'),
+ ('u', 'user', [],
+ 'revisions committed by user'),
+ ('', 'from', '',
+ ''),
+ ('', 'to', '',
+ ''),
+ ('', 'rhbranch', '',
+ ''),
+ ('', 'template', '',
+ 'display with template')],
+ 'hg rhlog [OPTION]... [FILE]')
def rhlog(ui, repo, *pats, **opts):
rev = opts.pop('rev')
bra0 = opts.pop('branch')
@@ -158,6 +195,9 @@ def rhlog(ui, repo, *pats, **opts):
opts['branch'] = [bra]
return commands.log(ui, repo, *map(urllib.unquote_plus, pats), **opts)
+@command('rhmanifest',
+ [('r', 'rev', '', 'show the specified revision')],
+ 'hg rhmanifest [-r REV] [PATH]')
def rhmanifest(ui, repo, path='', **opts):
"""output the sub-manifest of the specified directory"""
ui.write('<?xml version="1.0"?>\n')
@@ -169,6 +209,7 @@ def rhmanifest(ui, repo, path='', **opts):
ui.write('</repository>\n')
ui.write('</rhmanifest>\n')
+@command('rhsummary',[], 'hg rhsummary')
def rhsummary(ui, repo, **opts):
"""output the summary of the repository"""
ui.write('<?xml version="1.0"?>\n')
@@ -183,43 +224,3 @@ def rhsummary(ui, repo, **opts):
ui.write('</repository>\n')
ui.write('</rhsummary>\n')
-cmdtable = {
- 'rhannotate': (rhannotate,
- [('r', 'rev', '', 'revision'),
- ('u', 'user', None, 'list the author (long with -v)'),
- ('n', 'number', None, 'list the revision number (default)'),
- ('c', 'changeset', None, 'list the changeset'),
- ],
- 'hg rhannotate [-r REV] [-u] [-n] [-c] FILE...'),
- 'rhcat': (rhcat,
- [('r', 'rev', '', 'revision')],
- 'hg rhcat ([-r REV] ...) FILE...'),
- 'rhdiff': (rhdiff,
- [('r', 'rev', [], 'revision'),
- ('c', 'change', '', 'change made by revision')],
- 'hg rhdiff ([-c REV] | [-r REV] ...) [FILE]...'),
- 'rhlog': (rhlog,
- [
- ('r', 'rev', [], 'show the specified revision'),
- ('b', 'branch', [],
- 'show changesets within the given named branch'),
- ('l', 'limit', '',
- 'limit number of changes displayed'),
- ('d', 'date', '',
- 'show revisions matching date spec'),
- ('u', 'user', [],
- 'revisions committed by user'),
- ('', 'from', '',
- ''),
- ('', 'to', '',
- ''),
- ('', 'rhbranch', '',
- ''),
- ('', 'template', '',
- 'display with template')],
- 'hg rhlog [OPTION]... [FILE]'),
- 'rhmanifest': (rhmanifest,
- [('r', 'rev', '', 'show the specified revision')],
- 'hg rhmanifest [-r REV] [PATH]'),
- 'rhsummary': (rhsummary, [], 'hg rhsummary'),
-}