by
Changes to 6 files · Browse files at aaac856508a0 Showing diff from parent 123811ec40a6 774617fd1cc6 Diff from another changeset...
@@ -121,7 +121,14 @@ self.cwd = cwd or os.getcwd()
self.ui = ui
self.ui.setconfig('ui', 'interactive', 'off')
- self.repo = repo or hg.repository(ui, path=paths.find_root())
+ if repo:
+ self.repo = repo
+ else:
+ root = paths.find_root()
+ if root:
+ self.repo = hg.repository(ui, path=root)
+ else:
+ self.repo = None
self.pats = pats
self.opts = opts
self.tmproot = None
|
@@ -154,6 +154,11 @@ def _runcatch(ui, args):
try:
try:
+ checkhgversion(hglib.hgversion)
+ except util.Abort, inst:
+ ui.status(_("abort: %s!\n") % inst)
+ return 0
+ try:
return runcommand(ui, args)
finally:
ui.flush()
@@ -185,6 +190,10 @@ elif not cmd:
return help_(ui, 'shortlist')
+ if options['repository']:
+ path = ui.expandpath(options['repository'])
+ cmdoptions['repository'] = path
+ os.chdir(path)
path = paths.find_root(os.getcwd())
if path:
try:
@@ -194,9 +203,6 @@ pass
else:
lui = ui
- if options['repository']:
- path = lui.expandpath(options['repository'])
- cmdoptions['repository'] = path
_loaded = {}
extensions.loadall(ui)
@@ -562,6 +568,26 @@ else:
ui.write("%s\n" % first)
+def checkhgversion(v):
+ """range check the Mercurial version"""
+ # this is a series of hacks, but Mercurial's versioning scheme
+ # doesn't lend itself to a "correct" solution. This will at least
+ # catch people who have old Mercurial packages.
+ reqver = ['1', '2']
+ if not v or v == 'unknown' or len(v) == 12:
+ # can't make any intelligent decisions about unknown or hashes
+ return
+ vers = v.split('.')[:2]
+ if vers == reqver:
+ return
+ nextver = list(reqver)
+ nextver[1] = chr(ord(reqver[1])+1)
+ if vers == nextver:
+ return
+ raise util.Abort(_('This version of TortoiseHg requires Mercurial '
+ 'version %s.n to %s.n') % ('.'.join(reqver),
+ '.'.join(nextver)))
+
def version(ui, **opts):
"""output version and copyright information"""
ui.write(_('TortoiseHg Dialogs (version %s), '
|
@@ -10,7 +10,7 @@ import gtk
import gobject
import re
-from mercurial import util
+from mercurial import util, templatefilters
from mercurial.hgweb import webutil
from thgutil import hglib
from hggtk import gtklib
@@ -41,7 +41,6 @@ self.branch_names = {}
self.repo = repo
self.line_graph_data = graphdata
- self.author_re = re.compile('<.*@.*>', 0)
self.color_func = color_func
self.parents = [x.rev() for x in repo.parents()]
self.heads = [repo[x].rev() for x in repo.heads()]
@@ -136,11 +135,9 @@ bstr += '<span color="%s" background="%s"> %s </span> ' % \
('black', '#aaffaa', branch)
- if '<' in ctx.user():
- author = self.author_re.sub('', ctx.user()).strip(' ')
- else:
+ author = templatefilters.person(ctx.user())
+ if not author:
author = util.shortuser(ctx.user())
-
author = hglib.toutf(author)
date = hglib.displaytime(ctx.date())
utc = hglib.utctime(ctx.date())
|
|
|
|
|
Loading...