Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

Merge with stable

Changeset 49a7fdad2994

Parents 770e59048532

Parents e2f7b799cf8f

by Steve Borho

Changes to 7 files · Browse files at 49a7fdad2994 Showing diff from parent 770e59048532 e2f7b799cf8f Diff from another changeset...

 
14
15
16
17
 
18
19
20
 
98
99
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
102
103
 
145
146
147
 
 
148
149
150
 
14
15
16
 
17
18
19
20
 
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
 
160
161
162
163
164
165
166
167
@@ -14,7 +14,7 @@
 # this program; if not, write to the Free Software Foundation, Inc.,  # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.   -from tortoisehg.util import hglib +from tortoisehg.util import hglib, patchctx    from tortoisehg.hgqt.qtlib import geticon   @@ -98,6 +98,21 @@
  ctxfiles = self._ctx.files()   modified, added, removed = self._ctx.changesToParent(parent)   ismerge = bool(self._ctx.p2()) + + # Add the list of modified subrepos to the top of the list + if not isinstance(self._ctx, patchctx.patchctx): + from mercurial import subrepo + for s, sd in self._ctx.substate.items(): + srev = self._ctx.substate.get(s, subrepo.nullstate)[1] + sp1rev = self._ctx.p1().substate.get(s, subrepo.nullstate)[1] + sp2rev = '' + if ismerge: + sp2rev = self._ctx.p2().substate.get(s, subrepo.nullstate)[1] + if srev != sp1rev or (sp2rev != '' and srev != sp2rev): + wasmerged = ismerge and s in ctxfiles + files.append({'path': s, 'status': 'S', 'parent': parent, + 'wasmerged': wasmerged}) +   if self._fulllist and ismerge:   func = lambda x: True   else: @@ -145,6 +160,8 @@
  return QVariant(geticon('fileadd'))   elif current_file_desc['status'] == 'R':   return QVariant(geticon('filedelete')) + elif current_file_desc['status'] == 'S': + return QVariant(geticon('hg'))   #else:   # return QVariant(geticon('filemodify'))   elif role == Qt.FontRole:
 
14
15
16
17
 
18
 
19
20
21
 
37
38
39
 
40
41
42
 
14
15
16
 
17
18
19
20
21
22
 
38
39
40
41
42
43
44
@@ -14,8 +14,9 @@
 # this program; if not, write to the Free Software Foundation, Inc.,  # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.   -from tortoisehg.hgqt.repomodel import HgRepoListModel +from tortoisehg.hgqt.repomodel import HgRepoListModel, COLUMNNAMES  from tortoisehg.hgqt.graph import Graph, filelog_grapher +from tortoisehg.hgqt.i18n import _    from PyQt4.QtCore import *   @@ -37,6 +38,7 @@
  data is a HgHLRepo instance   """   HgRepoListModel.__init__(self, repo, '', [], False, parent) + COLUMNNAMES['Filename'] = _('Filename', 'column header')   self.setFilename(filename)     def setRepo(self, repo, branch='', fromhead=None, follow=False):
 
142
143
144
 
145
146
147
 
307
308
309
 
310
311
312
 
319
320
321
322
 
323
324
325
 
 
 
 
 
 
326
327
328
 
393
394
395
 
 
 
 
 
 
 
396
397
398
 
401
402
403
 
 
 
 
 
 
 
404
405
406
 
631
632
633
634
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
636
637
 
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
666
 
667
668
669
 
142
143
144
145
146
147
148
 
308
309
310
311
312
313
314
 
321
322
323
 
324
325
326
327
328
329
330
331
332
333
334
335
336
 
401
402
403
404
405
406
407
408
409
410
411
412
413
 
416
417
418
419
420
421
422
423
424
425
426
427
428
 
653
654
655
 
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
 
689
690
691
 
 
 
 
 
 
 
 
 
 
 
 
 
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
 
714
715
716
717
@@ -142,6 +142,7 @@
  self._parent = 0   self._lostMode = None   self._lastSearch = u'', False + self._lastScrollPosition = 0     self.actionDiffMode = QAction(qtlib.geticon('view-diff'),   _('View change as unified diff output'), @@ -307,6 +308,7 @@
  @pyqtSlot()   def clearDisplay(self):   self._filename = None + self._lastScrollPosition = 0   self.restrictModes(False, False, False)   self.sci.setMarginWidth(1, 0)   self.clearMarkup() @@ -319,10 +321,16 @@
  self.filenamelabel.setText(' ')   self.extralabel.hide()   - def displayFile(self, filename, status): + def displayFile(self, filename=None, status=None):   if isinstance(filename, (unicode, QString)):   filename = hglib.fromunicode(filename)   status = hglib.fromunicode(status) + if self._filename == filename: + # Get the last visible line to restore it after reloading the editor + self._lastScrollPosition = self.sci.firstVisibleLine() + else: + # Reset the scroll positions when the file is changed + self._lastScrollPosition = 0   self._filename, self._status = filename, status     self.clearMarkup() @@ -393,6 +401,13 @@
  return   elif self._mode == AnnMode:   self.sci.setSource(filename, self._ctx.rev()) + + # Recover the last scroll position + # Make sure that _lastScrollPosition never exceeds the amount of + # lines on the editor + self._lastScrollPosition = min(self._lastScrollPosition, \ + self.sci.lines() - 1) + self.sci.verticalScrollBar().setValue(self._lastScrollPosition)   else:   lexer = lexers.get_lexer(filename, fd.contents, self)   self.sci.setLexer(lexer) @@ -401,6 +416,13 @@
  self.sci.setText(fd.contents)   self.sci._updatemarginwidth()   + # Recover the last scroll position + # Make sure that _lastScrollPosition never exceeds the amount of + # lines on the editor + self._lastScrollPosition = min(self._lastScrollPosition, \ + self.sci.lines() - 1) + self.sci.verticalScrollBar().setValue(self._lastScrollPosition) +   self.highlightText(*self._lastSearch)   uf = hglib.tounicode(self._filename)   self.fileDisplayed.emit(uf, fd.contents or QString()) @@ -631,7 +653,25 @@
  if status == 'S':   try:   from mercurial import subrepo, commands - assert(ctx.rev() is None) + + def genSubrepoRevChangedDescription(sfrom, sto): + """Generate a subrepository revision change description""" + out = [] + opts = {'date':None, 'user':None, 'rev':[sfrom]} + if not sfrom: + out.append(_('Subrepo initialized to revision:') + u'\n\n') + else: + out.append(_('Revision has changed from:') + u'\n\n') + _ui.pushbuffer() + commands.log(_ui, srepo, **opts) + out.append(hglib.tounicode(_ui.popbuffer())) + out.append(_('To:') + u'\n') + opts['rev'] = [sto] + _ui.pushbuffer() + commands.log(_ui, srepo, **opts) + out.append(hglib.tounicode(_ui.popbuffer())) + return out +   srev = ctx.substate.get(wfile, subrepo.nullstate)[1]   sub = ctx.sub(wfile)   if isinstance(sub, subrepo.hgsubrepo): @@ -649,21 +689,29 @@
  out.append(_('File Status:') + u'\n')   out.append(hglib.tounicode(data))   out.append(u'\n') - if srev == '': - out.append(_('New subrepository') + u'\n\n') - elif srev != sactual: - out.append(_('Revision has changed from:') + u'\n\n') - opts = {'date':None, 'user':None, 'rev':[srev]} - _ui.pushbuffer() - commands.log(_ui, srepo, **opts) - out.append(hglib.tounicode(_ui.popbuffer())) - out.append(_('To:') + u'\n') - opts['rev'] = [sactual] - _ui.pushbuffer() - commands.log(_ui, srepo, **opts) - out.append(hglib.tounicode(_ui.popbuffer())) + sstatedesc = 'changed' + if ctx.rev() is not None: + sparent = ctx.p1().substate.get(wfile, subrepo.nullstate)[1] + out += genSubrepoRevChangedDescription(sparent, srev) + else: + sstatedesc = 'dirty' + if srev == '': + sstatedesc = 'new' + out.append(_('New subrepository') + u'\n\n') + elif srev != sactual: + sstatedesc = 'changed' + out.append(_('Revision has changed from:') + u'\n\n') + opts = {'date':None, 'user':None, 'rev':[srev]} + _ui.pushbuffer() + commands.log(_ui, srepo, **opts) + out.append(hglib.tounicode(_ui.popbuffer())) + out.append(_('To:') + u'\n') + opts['rev'] = [sactual] + _ui.pushbuffer() + commands.log(_ui, srepo, **opts) + out.append(hglib.tounicode(_ui.popbuffer()))   self.contents = u''.join(out) - self.flabel += _(' <i>(is a dirty sub-repository)</i>') + self.flabel += _(' <i>(is a %s sub-repository)</i>' % sstatedesc)   lbl = u' <a href="subrepo:%s">%s...</a>'   self.flabel += lbl % (hglib.tounicode(srepo.root), _('open'))   except (EnvironmentError, error.RepoError, util.Abort), e:
 
41
42
43
44
 
 
45
46
47
 
50
51
52
53
 
 
54
55
56
 
78
79
80
81
 
82
83
84
 
41
42
43
 
44
45
46
47
48
 
51
52
53
 
54
55
56
57
58
 
80
81
82
 
83
84
85
86
@@ -41,7 +41,8 @@
  list = QListWidget()   # enabled cols are listed in sorted order   for c in self.curcolumns: - item = QListWidgetItem(c) + item = QListWidgetItem(repomodel.COLUMNNAMES[c]) + item.columnid = c   item.setFlags(Qt.ItemIsSelectable |   Qt.ItemIsEnabled |   Qt.ItemIsDragEnabled | @@ -50,7 +51,8 @@
  list.addItem(item)   # disabled cols are listed last   for c in self.disabled: - item = QListWidgetItem(c) + item = QListWidgetItem(repomodel.COLUMNNAMES[c]) + item.columnid = c   item.setFlags(Qt.ItemIsSelectable |   Qt.ItemIsEnabled |   Qt.ItemIsDragEnabled | @@ -78,7 +80,7 @@
  for i in xrange(self.list.count()):   item = self.list.item(i)   if item.checkState() == Qt.Checked: - cols.append(str(item.text())) + cols.append(item.columnid)   s.setValue('workbench/columns', cols)   QDialog.accept(self)  
 
35
36
37
38
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
41
42
 
459
460
461
462
 
463
464
465
 
35
36
37
 
 
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
474
475
476
 
477
478
479
480
@@ -35,8 +35,23 @@
  "darkcyan", "gray", "yellow", ]  COLORS = [str(QColor(x).name()) for x in COLORS]   -ALLCOLUMNS = ('Graph', 'Rev', 'Branch', 'Description', 'Author', 'Tags', 'Node', - 'Age', 'LocalTime', 'UTCTime', 'Changes') +COLUMNHEADERS = ( + ('Graph', _('Graph', 'column header')), + ('Rev', _('Rev', 'column header')), + ('Branch', _('Branch', 'column header')), + ('Description', _('Description', 'column header')), + ('Author', _('Author', 'column header')), + ('Tags', _('Tags', 'column header')), + ('Node', _('Node', 'column header')), + ('Age', _('Age', 'column header')), + ('LocalTime', _('Local Time', 'column header')), + ('UTCTime', _('UTC Time', 'column header')), + ('Changes', _('Changes', 'column header')), + ) + +COLUMNNAMES = dict(COLUMNHEADERS) + +ALLCOLUMNS = [h[0] for h in COLUMNHEADERS]    UNAPPLIED_PATCH_COLOR = '#999999'   @@ -459,7 +474,7 @@
  def headerData(self, section, orientation, role):   if orientation == Qt.Horizontal:   if role == Qt.DisplayRole: - return QVariant(self._columns[section]) + return QVariant(COLUMNNAMES[self._columns[section]])   if role == Qt.TextAlignmentRole:   return QVariant(Qt.AlignLeft)   return nullvariant
 
1092
1093
1094
 
 
 
 
 
 
 
1095
1096
 
1097
1098
1099
 
1162
1163
1164
 
 
 
 
 
 
 
1165
1166
1167
 
1244
1245
1246
 
 
 
 
 
 
1247
1248
1249
 
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
 
1103
1104
1105
1106
 
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
 
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
@@ -1092,8 +1092,15 @@
  a.setIcon(qtlib.getmenuicon(icon))   a.triggered.connect(cb)   menu.addAction(a) + + if 'transplant' in self.repo.extensions(): + a = QAction(_('Transplant Selected to local'), self) + a.setIcon(qtlib.getmenuicon('hg-transplant')) + a.triggered.connect(self.transplantRevisions) + menu.addAction(a) +   if 'reviewboard' in self.repo.extensions(): - a = QAction(_('Post Pair to Review Board...'), self) + a = QAction(_('Post Selected to Review Board...'), self)   a.triggered.connect(self.sendToReviewBoard)   menu.addAction(a)   self.paircmenu = menu @@ -1162,6 +1169,13 @@
  a.setIcon(qtlib.getmenuicon(icon))   a.triggered.connect(cb)   menu.addAction(a) + + if 'transplant' in self.repo.extensions(): + a = QAction(_('Transplant Selected to local'), self) + a.setIcon(qtlib.getmenuicon('hg-transplant')) + a.triggered.connect(self.transplantRevisions) + menu.addAction(a) +   if 'reviewboard' in self.repo.extensions():   a = QAction(_('Post Selected to Review Board...'), self)   a.triggered.connect(self.sendToReviewBoard) @@ -1244,6 +1258,12 @@
  cmdline = ['transplant', '--repository', self.repo.root, str(self.rev)]   self.runCommand(cmdline)   + def transplantRevisions(self): + cmdline = ['transplant', '--repository', self.repo.root] + for rev in self.repoview.selectedRevisions(): + cmdline.append(str(rev)) + self.runCommand(cmdline) +   def backoutToRevision(self):   dlg = backout.BackoutDialog(self.repo, str(self.rev), self)   dlg.finished.connect(dlg.deleteLater)
 
157
158
159
 
160
161
162
 
157
158
159
160
161
162
163
@@ -157,6 +157,7 @@
  sp.setHeightForWidth(self.fileview.sizePolicy().hasHeightForWidth())   self.fileview.setSizePolicy(sp)   self.fileview.setMinimumSize(QSize(0, 0)) + self.fileview.linkActivated.connect(self.linkActivated)     self.revpanel = RevPanelWidget(self.repo)   self.revpanel.linkActivated.connect(self.linkActivated)