by
Changes to 7 files · Browse files at 17fc2562d687 Showing diff from parent 16b2c90fc6a7 da5288952fe8 Diff from another changeset...
@@ -232,6 +232,12 @@ else:
self.append_all_patch_diffs()
+ # reset position of diff pane's scroll bar
+ adj = self.diffscroller.get_vadjustment()
+ adj.set_value(0)
+ adj = self.diffscroller.get_hadjustment()
+ adj.set_value(0)
+
def generate_change_header(self):
self.summarypanel.update(self.currev, self.csetstyle)
self.summarybox.show()
@@ -424,6 +430,7 @@ scroller = gtk.ScrolledWindow()
scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
details_frame.add(scroller)
+ self.diffscroller = scroller
details_box = gtk.VBox()
scroller.add_with_viewport(details_box)
@@ -499,11 +506,11 @@ if revid:
revid = revid_markup(revid)
if branch:
- return '%s (%s) [%s] %s' % (revnum, revid, branch, summary)
+ return '%s (%s) %s %s' % (revnum, revid, branch, summary)
return '%s (%s) %s' % (revnum, revid, summary)
else:
if branch:
- return '%s [%s] - %s' % (revnum, branch, summary)
+ return '%s - %s %s' % (revnum, branch, summary)
return '%s - %s' % (revnum, summary)
if item in ('cset', 'transplant', 'patch'):
if isinstance(value, basestring):
@@ -520,27 +527,27 @@ raise csinfo.UnknownItem(item)
def widget_func(widget, item, markups):
def linkwidget(revnum, revid, summary, highlight=None, branch=None):
+ # revision label
opts = dict(underline='single', foreground='#0000FF')
if highlight:
opts['weight'] = 'bold'
- revfmt = '%s (%s)'
- revargs = [gtklib.markup(revnum, **opts),
- revid_markup(revid, **opts)]
+ rev = '%s (%s)' % (gtklib.markup(revnum, **opts),
+ revid_markup(revid, **opts))
+ revlabel = gtk.Label()
+ revlabel.set_markup(rev)
+ revlabel.set_selectable(True)
+ revlabel.connect('button-release-event', self.link_event, revnum)
+ # summary & branch label
+ sum = gtklib.markup(summary)
if branch:
- revfmt = '%s (%s) [%s]'
- revargs.append(gtklib.markup(branch, color='black',
- background='#aaffaa'))
-
- rev = revfmt % tuple(revargs)
- link = gtk.Label()
- link.set_markup(rev)
- link.set_selectable(True)
- link.connect('button-release-event', self.link_event, revnum)
- text = gtk.Label(summary)
- text.set_selectable(True)
+ sum = gtklib.markup(branch, color='black',
+ background='#aaffaa') + ' ' + sum
+ sumlabel = gtk.Label()
+ sumlabel.set_markup(sum)
+ sumlabel.set_selectable(True)
box = gtk.HBox()
- box.pack_start(link, False, False)
- box.pack_start(text, True, True, 4)
+ box.pack_start(revlabel, False, False)
+ box.pack_start(sumlabel, True, True, 4)
return box
def genwidget(param):
if isinstance(param, basestring):
|
@@ -159,14 +159,14 @@ pass
while self.hgthread.geterrqueue().qsize():
try:
- msg = self.hgthread.geterrqueue().get(0)
+ msg = hglib.toutf(self.hgthread.geterrqueue().get(0))
self.textbuffer.insert_with_tags_by_name(enditer, msg, 'error')
self.textview.scroll_to_mark(self.textbuffer.get_insert(), 0)
except Queue.Empty:
pass
while self.stdoutq.qsize():
try:
- msg = self.stdoutq.get(0)
+ msg = hglib.toutf(self.stdoutq.get(0))
self.textbuffer.insert_with_tags_by_name(enditer, msg, 'error')
self.textview.scroll_to_mark(self.textbuffer.get_insert(), 0)
except Queue.Empty:
|
@@ -239,15 +239,7 @@ else:
lui = ui
- _loaded = {}
extensions.loadall(ui)
- for name, module in extensions.extensions():
- if name in _loaded:
- continue
- extsetup = getattr(module, 'extsetup', None)
- if extsetup:
- extsetup()
- _loaded[name] = 1
if options['quiet']:
ui.quiet = True
|
@@ -384,7 +384,7 @@ return
if mode == 0: # Rev Range
try:
- opts['revs'] = cmdutil.revrange(self.repo, [text])
+ opts['revlist'] = cmdutil.revrange(self.repo, [text])
except Exception, e:
gdialog.Prompt(_('Invalid revision range'), str(e), self).run()
return
@@ -1394,35 +1394,28 @@ return
confirm_push = False
- try:
- dest_repo = hg.repository(self.ui, path=remote_path)
- if not dest_repo.local():
- if self.forcepush:
- title = _('Confirm Forced Push to Remote Repository')
- text = _('Forced push to remote repository\n%s\n'
- '(creating new heads in remote if needed)?') % remote_path
- buttontext = _('Forced &Push')
- else:
- title = _('Confirm Push to remote Repository')
- text = _('Push to remote repository\n%s\n?') % remote_path
- buttontext = _('&Push')
- confirm_push = True
- elif self.forcepush:
- title = _('Confirm Forced Push')
- text = _('Forced push to repository\n%s\n'
- '(creating new heads if needed)?') % remote_path
+ if not hg.islocal(remote_path):
+ if self.forcepush:
+ title = _('Confirm Forced Push to Remote Repository')
+ text = _('Forced push to remote repository\n%s\n'
+ '(creating new heads in remote if needed)?') % remote_path
buttontext = _('Forced &Push')
- confirm_push = True
- if confirm_push:
- dlg = gdialog.CustomPrompt(title, text,
- None, (buttontext, _('&Cancel')), default=1, esc=1)
- if dlg.run() != 0:
- return
- except hglib.RepoError, e:
- dlg = gdialog.Prompt(_('Invalid Remote Repository'), str(e), self,
- type=gtk.MESSAGE_ERROR)
- dlg.run()
- return
+ else:
+ title = _('Confirm Push to remote Repository')
+ text = _('Push to remote repository\n%s\n?') % remote_path
+ buttontext = _('&Push')
+ confirm_push = True
+ elif self.forcepush:
+ title = _('Confirm Forced Push')
+ text = _('Forced push to repository\n%s\n'
+ '(creating new heads if needed)?') % remote_path
+ buttontext = _('Forced &Push')
+ confirm_push = True
+ if confirm_push:
+ dlg = gdialog.CustomPrompt(title, text,
+ None, (buttontext, _('&Cancel')), default=1, esc=1)
+ if dlg.run() != 0:
+ return
cmdline = ['hg', 'push'] + self.get_proxy_args()
if self.forcepush:
|
@@ -54,7 +54,7 @@ import re
from mercurial.node import nullrev
-from mercurial import cmdutil, util
+from mercurial import cmdutil, util, match
from tortoisehg.util import hglib
@@ -502,61 +502,34 @@ pats - list of file names or patterns
opts - command line options for log command
'''
-
+ matching_revs = []
only_branch = opts.get('branch', None)
-
- # Log searches: pattern, keyword, date, etc
df = False
if opts['date']:
df = util.matchdate(opts['date'])
- stack = []
- get = util.cachefunc(lambda r: repo[r])
- changeiter, matchfn = cmdutil.walkchangerevs(repo.ui, repo, pats, get, opts)
- for st, rev, fns in changeiter:
- if st == 'iter':
- if stack:
- yield stack.pop()
- continue
- if st != 'add':
- continue
+ def prep(ctx, fns):
+ if only_branch and ctx.branch() != only_branch:
+ return
+ if opts['no_merges'] and len(ctx.parents()) == 2:
+ return
+ if opts['only_merges'] and len(ctx.parents()) != 2:
+ return
+ if df and not df(ctx.date()[0]):
+ return
+ if opts['user'] and not [k for k in opts['user'] if k in ctx.user()]:
+ return
+ if opts['keyword']:
+ for k in [kw.lower() for kw in opts['keyword']]:
+ if (k in ctx.user().lower() or
+ k in ctx.description().lower() or
+ k in " ".join(ctx.files()).lower()):
+ break
+ else:
+ return
+ matching_revs.append(ctx.rev())
- ctx = get(rev)
-
- if only_branch:
- if ctx.branch() != only_branch:
- continue
-
- parents = __get_parents(repo, rev)
- if opts['no_merges'] and len(parents) == 2:
- continue
- if opts['only_merges'] and len(parents) != 2:
- continue
-
- if df:
- changes = get(rev)
- if not df(changes[2][0]):
- continue
-
- # TODO: add copies/renames later
- if opts['keyword']:
- miss = 0
- for k in [kw.lower() for kw in opts['keyword']]:
- if not (k in ctx.user().lower() or
- k in ctx.description().lower() or
- k in " ".join(ctx.files()).lower()):
- miss = 1
- break
- if miss:
- continue
-
- if opts['user']:
- miss = 0
- for u in [u.lower() for u in opts['user']]:
- if u not in ctx.user().lower():
- miss = 1
- break
- if miss:
- continue
-
- stack.append((rev, (0,0), [], None))
+ m = match.match(repo.root, repo.root, pats)
+ for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
+ if ctx.rev() in matching_revs:
+ yield (ctx.rev(), (0,0), [], None)
|
@@ -383,7 +383,7 @@
# if both --change and --rev is given, remove --rev in 3-way mode,
# and --change in normal mode
- if 'change' in opts and opts.get('rev'):
+ if 'change' in opts and opts['change'] and opts.get('rev'):
if '$parent2' in ''.join(diffopts):
del opts['rev']
else:
|
@@ -56,11 +56,14 @@ """
try:
return s.decode('utf-8').encode(_encoding)
- except UnicodeDecodeError:
+ except (UnicodeDecodeError, UnicodeEncodeError):
pass
- except UnicodeEncodeError:
+ try:
+ return s.decode('utf-8').encode(_fallbackencoding)
+ except (UnicodeDecodeError, UnicodeEncodeError):
pass
- return s.decode('utf-8').encode(_fallbackencoding)
+ u = s.decode('utf-8', 'replace') # last ditch
+ return u.encode(_encoding, 'replace')
_tabwidth = None
def gettabwidth(ui):
|
Loading...