Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph

default Merge with stable

Changeset 8cf34332ed01

Parents 57fa0272f191

Parents c5b82b5a2bc7

by Steve Borho

Changes to 21 files · Browse files at 8cf34332ed01 Showing diff from parent 57fa0272f191 c5b82b5a2bc7 Diff from another changeset...

 
262
263
264
 
 
 
265
266
267
268
 
 
 
269
270
271
 
277
278
279
280
281
 
282
283
284
 
262
263
264
265
266
267
268
269
 
 
270
271
272
273
274
275
 
281
282
283
 
 
284
285
286
287
@@ -262,10 +262,14 @@
  _stderr = sys.stderr   sys.stderr = errorstream   try: + # Ensure that all unset dirstate entries can be updated. + time.sleep(2) + updated_any = False   for r in sorted(roots):   try: - shlib.update_thgstatus(_ui, r, wait=False) - shlib.shell_notify([r]) + if shlib.update_thgstatus(_ui, r, wait=False): + updated_any = True + shlib.shell_notify([r], noassoc=True)   logger.msg('Updated ' + r)   except (IOError, OSError):   print "IOError or OSError on updating %s (check permissions)" % r @@ -277,8 +281,7 @@
  failedroots.add(r)   notifypaths -= failedroots   if notifypaths: - time.sleep(2) - shlib.shell_notify(list(notifypaths)) + shlib.shell_notify(list(notifypaths), noassoc=not updated_any)   logger.msg('Shell notified')   errmsg = errorstream.getvalue()   if errmsg:
Added image
 
6
7
8
 
9
10
11
 
14
15
16
17
 
18
19
20
 
676
677
678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
679
680
681
 
712
713
714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
715
716
717
 
6
7
8
9
10
11
12
 
15
16
17
 
18
19
20
21
 
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
 
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
@@ -6,6 +6,7 @@
 # GNU General Public License version 2, incorporated herein by reference.    import os +import re    from mercurial import ui, util, error   @@ -14,7 +15,7 @@
 from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt.messageentry import MessageEntry  from tortoisehg.hgqt import qtlib, qscilib, status, cmdui, branchop, revpanel -from tortoisehg.hgqt import hgrcutil, mq +from tortoisehg.hgqt import hgrcutil, mq, lfprompt    from PyQt4.QtCore import *  from PyQt4.QtGui import * @@ -676,6 +677,22 @@
  self.msgte.setFocus()   return   + linkmandatory = self.repo.ui.config('tortoisehg', + 'issue.linkmandatory', False) + if linkmandatory: + issueregex = self.repo.ui.config('tortoisehg', 'issue.regex') + if issueregex: + m = re.search(issueregex, msg) + if not m: + qtlib.WarningMsgBox(_('Nothing Commited'), + _('No issue link was found in the commit message. ' + 'The commit message should contain an issue ' + 'link. Configure this in the \'Issue Tracking\' ' + 'section of the settings.'), + parent=self) + self.msgte.setFocus() + return False +   commandlines = []     brcmd = [] @@ -712,6 +729,22 @@
  (_('&Add'), _('Cancel')), 0, 1,   checkedUnknowns).run()   if res == 0: + haslf = 'largefiles' in repo.extensions() + haskbf = 'kbfiles' in repo.extensions() + if haslf or haskbf: + result = lfprompt.promptForLfiles(self, repo.ui, repo, + checkedUnknowns, haskbf) + if not result: + return + checkedUnknowns, lfiles = result + if lfiles: + if haslf: + cmd = ['add', '--repository', repo.root, '--large'] + \ + [repo.wjoin(f) for f in lfiles] + else: + cmd = ['add', '--repository', repo.root, '--bf'] + \ + [repo.wjoin(f) for f in lfiles] + commandlines.append(cmd)   cmd = ['add', '--repository', repo.root] + \   [repo.wjoin(f) for f in checkedUnknowns]   commandlines.append(cmd)
 
47
48
49
50
 
51
52
53
 
72
73
74
 
75
76
77
 
302
303
304
 
 
 
305
306
307
 
315
316
317
 
 
318
319
320
 
324
325
326
 
 
 
327
328
329
 
367
368
369
 
 
 
370
371
 
47
48
49
 
50
51
52
53
 
72
73
74
75
76
77
78
 
303
304
305
306
307
308
309
310
311
 
319
320
321
322
323
324
325
326
 
330
331
332
333
334
335
336
337
338
 
376
377
378
379
380
381
382
383
@@ -47,7 +47,7 @@
  return None   try:   data = fctx.data() - if '\0' in data: + if '\0' in data or ctx.isStandin(wfile):   self.error = p + _('File is binary.\n')   return None   except (EnvironmentError, util.Abort), e: @@ -72,6 +72,7 @@
  return 'C'   return None   + isbfile = False   repo = ctx._repo   self.flabel += u'<b>%s</b>' % hglib.tounicode(wfile)   @@ -302,6 +303,9 @@
  else:   self.contents = olddata   self.flabel += _(' <i>(was deleted)</i>') + elif hasattr(ctx.p1(), 'hasStandin') and ctx.p1().hasStandin(wfile): + self.error = 'binary file' + self.flabel += _(' <i>(was deleted)</i>')   else:   self.flabel += _(' <i>(was added, now missing)</i>')   return @@ -315,6 +319,8 @@
  return   else:   data = util.posixfile(absfile, 'r').read() + elif ctx.hasStandin(wfile): + data = '\0'   else:   data = ctx.filectx(wfile).data()   if '\0' in data: @@ -324,6 +330,9 @@
  return     if status in ('M', 'A'): + if ctx.hasStandin(wfile): + wfile = ctx.findStandin(wfile) + isbfile = True   res = self.checkMaxDiff(ctx, wfile, maxdiff)   if res is None:   if status == 'A': @@ -367,5 +376,8 @@
  revs = [str(ctx), str(ctx2)]   diffopts = patch.diffopts(repo.ui, {})   diffopts.git = False + if isbfile: + olddata += '\0' + newdata += '\0'   self.diff = mdiff.unidiff(olddata, olddate, newdata, newdate,   oldname, wfile, revs, diffopts)
 
144
145
146
 
147
148
149
 
144
145
146
147
148
149
150
@@ -144,6 +144,7 @@
  for lst, flag in ((added, 'A'), (modified, 'M'), (removed, 'R')):   for f in filter(func, lst):   wasmerged = ismerge and f in ctxfiles + f = self._ctx.removeStandin(f)   files.append({'path': f, 'status': flag, 'parent': parent,   'wasmerged': wasmerged})   return files
 
309
310
311
 
 
 
312
313
314
 
434
435
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
438
439
 
674
675
676
 
 
 
 
 
 
 
 
 
677
678
679
 
309
310
311
312
313
314
315
316
317
 
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
 
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
@@ -309,6 +309,9 @@
  self.actionNextDiff.setEnabled(False)   self.actionPrevDiff.setEnabled(False)   + self.maxWidth = 0 + self.sci.showHScrollBar(False) +   def displayFile(self, filename=None, status=None):   if isinstance(filename, (unicode, QString)):   filename = hglib.fromunicode(filename) @@ -434,6 +437,20 @@
  self.actionNextDiff.setEnabled(bool(self._diffs))   self.actionPrevDiff.setEnabled(bool(self._diffs))   + lexer = self.sci.lexer() + + if lexer: + font = self.sci.lexer().font(0) + else: + font = self.sci.font() + + fm = QFontMetrics(font) + maxWidth = fm.maxWidth() + lines = self.sci.text().split('\n') + widths = [fm.width(line) + maxWidth for line in lines] + self.maxWidth = max(widths) + self.updateScrollBar() +   #   # These four functions are used by Shift+Cursor actions in revdetails   # @@ -674,6 +691,15 @@
  add(name, func)   menu.exec_(point)   + def resizeEvent(self, event): + super(HgFileView, self).resizeEvent(event) + self.updateScrollBar() + + def updateScrollBar(self): + sbWidth = self.sci.verticalScrollBar().width() + scrollWidth = self.maxWidth + sbWidth - self.sci.width() + self.sci.showHScrollBar(scrollWidth > 0) + self.sci.horizontalScrollBar().setRange(0, scrollWidth)    class AnnotateView(qscilib.Scintilla):   'QScintilla widget capable of displaying annotations'
 
10
11
12
13
 
14
15
16
 
385
386
387
 
 
388
389
390
 
400
401
402
 
 
 
 
403
404
405
 
469
470
471
 
 
472
473
474
 
 
 
 
475
476
477
 
10
11
12
 
13
14
15
16
 
385
386
387
388
389
390
391
392
 
402
403
404
405
406
407
408
409
410
411
 
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
@@ -10,7 +10,7 @@
   from mercurial import ui, hg, error, commands, match, util, subrepo   -from tortoisehg.hgqt import htmlui, visdiff, qtlib, htmldelegate, thgrepo, cmdui +from tortoisehg.hgqt import htmlui, visdiff, qtlib, htmldelegate, thgrepo, cmdui, settings  from tortoisehg.util import paths, hglib, thread2  from tortoisehg.hgqt.i18n import _   @@ -385,6 +385,8 @@
  pass     def run(self): + haskbf = settings.hasExtension('kbfiles') + haslf = settings.hasExtension('largefiles')   self.thread_id = int(QThread.currentThreadId())     def emitrow(row): @@ -400,6 +402,10 @@
  try:   fname, line, rev, addremove, user, text, tail = \   self.fullmsg.split('\0', 6) + if haslf and thgrepo.isLfStandin(fname): + raise ValueError + if (haslf or haskbf) and thgrepo.isBfStandin(fname): + raise ValueError   text = hglib.tounicode(text)   text = Qt.escape(text)   text = '<b>%s</b> <span>%s</span>' % (addremove, text) @@ -469,9 +475,15 @@
  unit = _('files')   total = len(ctx.manifest())   count = 0 + haskbf = settings.hasExtension('kbfiles') + haslf = settings.hasExtension('largefiles')   for wfile in ctx: # walk manifest   if self.canceled:   break + if haslf and thgrepo.isLfStandin(wfile): + continue + if (haslf or haskbf) and thgrepo.isBfStandin(wfile): + continue   self.progress.emit(topic, count, wfile, unit, total)   count += 1   if not matchfn(wfile):
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​lfprompt.py Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@@ -0,0 +1,73 @@
+# bfprompt.py - prompt to add large files as bfiles +# +# Copyright 2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +import os + +from mercurial import match +from tortoisehg.hgqt import qtlib +from tortoisehg.hgqt.i18n import _ + +class LfilesPrompt(qtlib.CustomPrompt): + def __init__(self, parent, files=None): + qtlib.CustomPrompt.__init__(self, _('Confirm Add'), + _('Some of the files that you have selected are of a size ' + 'over 10 MB. You may make more efficient use of disk space ' + 'by adding these files as largefiles, which will store only the ' + 'most recent revision of each file in your local repository, ' + 'with older revisions available on the server. Do you wish ' + 'to add these files as largefiles?'), parent, + (_('Add as &Largefiles'), _('Add as &Normal Files'), _('Cancel')), + 0, 2, files) + +class BfilesPrompt(qtlib.CustomPrompt): + def __init__(self, parent, files=None): + qtlib.CustomPrompt.__init__(self, _('Confirm Add'), + _('Some of the files that you have selected are of a size ' + 'over 10 MB. You may make more efficient use of disk space ' + 'by adding these files as bfiles, which will store only the ' + 'most recent revision of each file in your local repository, ' + 'with older revisions available on the server. Do you wish ' + 'to add these files as bfiles?'), parent, + (_('Add as &Bfiles'), _('Add as &Normal Files'), _('Cancel')), + 0, 2, files) + +def promptForLfiles(parent, ui, repo, files, haskbf=False): + lfiles = [] + usekbf = os.path.exists('.kbf') + uself = os.path.exists('.hglf') + useneither = not usekbf and not uself + if haskbf: + section = 'kilnbfiles' + else: + section = 'largefiles' + minsize = int(ui.config(section, 'size', default='10')) + patterns = ui.config(section, 'patterns', default=()) + if patterns: + patterns = patterns.split(' ') + matcher = match.match(repo.root, '', list(patterns)) + else: + matcher = None + for wfile in files: + if not matcher or not matcher(wfile) or useneither: + filesize = os.path.getsize(repo.wjoin(wfile)) + if filesize >= 10*1024*1024 and (filesize < minsize*1024*1024 or useneither): + lfiles.append(wfile) + if lfiles: + if haskbf: + ret = BfilesPrompt(parent, files).run() + else: + ret = LfilesPrompt(parent, files).run() + if ret == 0: + # add as largefiles/bfiles + for lfile in lfiles: + files.remove(lfile) + elif ret == 1: + # add as normal files + lfiles = [] + elif ret == 2: + return None + return files, lfiles
 
251
252
253
 
 
 
254
255
256
 
258
259
260
261
 
262
263
264
 
251
252
253
254
255
256
257
258
259
 
261
262
263
 
264
265
266
267
@@ -251,6 +251,9 @@
  if not pathinstatus(path, status, uncleanpaths):   continue   + origpath = path + path = self._repo.removeStandin(path) +   e = treeroot   for p in hglib.tounicode(path).split('/'):   if not p in e: @@ -258,7 +261,7 @@
  e = e[p]     for st, filesofst in status.iteritems(): - if path in filesofst: + if origpath in filesofst:   e.setstatus(st)   break   else:
 
97
98
99
100
101
 
 
 
 
 
102
103
104
105
106
107
 
108
109
110
 
213
214
215
 
 
216
217
 
 
218
219
220
 
97
98
99
 
 
100
101
102
103
104
105
106
107
108
109
 
110
111
112
113
 
216
217
218
219
220
221
222
223
224
225
226
227
@@ -97,14 +97,17 @@
    def run(self):   try: - wctx = repo[None] - wctx.status(ignored=True, unknown=True) + repo.bfstatus = True + repo.lfstatus = True + stat = repo.status(ignored=True, unknown=True) + repo.bfstatus = False + repo.lfstatus = False   trashcan = repo.join('Trashcan')   if os.path.isdir(trashcan):   trash = os.listdir(trashcan)   else:   trash = [] - self.files = wctx.unknown(), wctx.ignored(), trash + self.files = stat[4], stat[5], trash   except Exception, e:   self.error = str(e)   @@ -213,8 +216,12 @@
  self.showMessage.emit('')   match = hglib.matchall(repo)   match.dir = directories.append + repo.bfstatus = True + repo.lfstatus = True   status = repo.status(match=match, ignored=opts['ignored'],   unknown=opts['unknown'], clean=False) + repo.bfstatus = False + repo.lfstatus = False   files = status[4] + status[5]     def remove(remove_func, name):
 
64
65
66
67
 
68
69
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
72
73
 
64
65
66
 
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@@ -64,10 +64,35 @@
  chm = os.path.join(paths.bin_path, 'doc', 'TortoiseHg.chm')   if os.path.exists(chm):   fullurl = (r'mk:@MSITStore:%s::/' % chm) + url - QDesktopServices.openUrl(QUrl.fromLocalFile(fullurl)) + openlocalurl(fullurl)   return   QDesktopServices.openUrl(QUrl(fullurl))   +def startswith(strQstring, startstr): + '''calls startsWith of QString or startswith for others + + takes st, unicode or QString as strQstring''' + + if isinstance(strQstring, QString): + return strQstring.startsWith(startstr) + else: + return strQstring.startswith(startstr) + +def openlocalurl(path): + '''open the given path with the default application + + takes str, unicode or QString as argument''' + + if isinstance(path, str): + path = hglib.tounicode(path) + if os.name == 'nt' and startswith(path, '\\\\'): + # network share, special handling because of qt bug 13359 + # see http://bugreports.qt.nokia.com/browse/QTBUG-13359 + qurl = QUrl().setUrl(QDir.toNativeSeparators(path)) + else: + qurl = QUrl.fromLocalFile(path) + return QDesktopServices.openUrl(qurl) +  def editfiles(repo, files, lineno=None, search=None, parent=None):   if len(files) == 1:   path = repo.wjoin(files[0])
 
12
13
14
15
 
16
17
18
 
107
108
109
 
 
 
 
 
 
 
 
 
 
 
110
111
112
 
147
148
149
 
 
 
 
 
150
151
152
 
153
154
155
 
167
168
169
170
 
171
172
 
173
174
175
176
177
 
 
 
 
178
179
180
 
198
199
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
202
203
 
12
13
14
 
15
16
17
18
 
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
 
158
159
160
161
162
163
164
165
166
167
 
168
169
170
171
 
183
184
185
 
186
187
 
188
189
190
191
192
193
194
195
196
197
198
199
200
 
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
@@ -12,7 +12,7 @@
   from tortoisehg.util import hglib, shlib  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib, status, cmdui +from tortoisehg.hgqt import qtlib, status, cmdui, lfprompt    from PyQt4.QtCore import *  from PyQt4.QtGui import * @@ -107,6 +107,17 @@
  hbox.addWidget(bb)   toplayout.addLayout(hbox)   self.bb = bb + + if self.command == 'add': + if 'largefiles' in self.repo.extensions(): + self.addLfilesButton = QPushButton(_('Add &Largefiles')) + elif 'kbfiles' in self.repo.extensions(): + self.addLfilesButton = QPushButton(_("Add &Bfiles")) + else: + self.addLfilesButton = None + if self.addLfilesButton: + self.addLfilesButton.clicked.connect(self.addLfiles) + bb.addButton(self.addLfilesButton, BB.ActionRole)     layout.addWidget(self.statusbar)   @@ -147,9 +158,14 @@
  _('No operation to perform'),   parent=self)   return + self.repo.bfstatus = True + self.repo.lfstatus = True + repostate = self.repo.status() + self.repo.bfstatus = False + self.repo.lfstatus = False   if self.command == 'remove':   if not self.chk.isChecked(): - modified = self.repo.status()[0] + modified = repostate[0]   selmodified = []   for wfile in files:   if wfile in modified: @@ -167,14 +183,18 @@
  cmdline.append('--force')   elif ret == 2:   return - wctx = self.repo[None] + unknown, ignored = repostate[4:6]   for wfile in files: - if wfile not in wctx: + if wfile in unknown or wfile in ignored:   try:   util.unlink(wfile)   except EnvironmentError:   pass   files.remove(wfile) + elif self.command == 'add': + if 'largefiles' in self.repo.extensions() or 'kbfiles' in self.repo.extensions(): + self.addWithPrompt(files) + return   if files:   cmdline.extend(files)   self.files = files @@ -198,6 +218,40 @@
  s.setValue('quickop/forceremove', self.chk.isChecked())   QDialog.reject(self)   + def addLfiles(self): + if 'kbfiles' in self.repo.extensions(): + cmdline = ['add', '--bf'] + else: + cmdline = ['add', '--large'] + files = self.stwidget.getChecked() + if not files: + qtlib.WarningMsgBox(_('No files selected'), + _('No operation to perform'), + parent=self) + return + cmdline.extend(files) + self.files = files + self.cmd.run(cmdline) + + def addWithPrompt(self, files): + result = lfprompt.promptForLfiles(self, self.repo.ui, self.repo, files, + 'kbfiles' in self.repo.extensions()) + if not result: + return + files, bfiles = result + if files: + cmdline = ['add'] + cmdline.extend(files) + self.files = files + self.cmd.run(cmdline) + if bfiles: + if 'kbfiles' in self.repo.extensions(): + cmdline = ['add', '--bf'] + else: + cmdline = ['add', '--large'] + cmdline.extend(bfiles) + self.files = bfiles + self.cmd.run(cmdline)    instance = None  class HeadlessQuickop(QWidget):
 
224
225
226
 
227
228
229
 
644
645
646
 
647
 
648
649
650
 
224
225
226
227
228
229
230
 
645
646
647
648
649
650
651
652
653
@@ -224,6 +224,7 @@
    showMessage = pyqtSignal(QString)   openRepo = pyqtSignal(QString, bool) + removeRepo = pyqtSignal(QString)     def __init__(self, parent, showSubrepos=False, showNetworkSubrepos=False,   showShortPaths=False): @@ -644,7 +645,9 @@
  self.tview.model().addGroup(_('New Group'))     def removeSelected(self): + root = self.selitem.internalPointer().rootpath()   self.tview.removeSelected() + self.removeRepo.emit(hglib.tounicode(root))     @pyqtSlot(QString, QString)   def shortNameChanged(self, uroot, uname):
1
2
3
4
5
6
7
8
9
10
 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
 
 
 
 
 
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
 
 
 
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
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
678
679
680
681
682
683
684
685
686
687
688
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
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
 
 
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1
2
3
4
5
6
7
8
9
 
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
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
678
679
680
681
682
683
684
685
686
687
688
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
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
 # settings.py - Configuration dialog for TortoiseHg and Mercurial  #  # Copyright 2010 Steve Borho <steve@borho.org>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.    import os   -from mercurial import ui, util, error +from mercurial import ui, util, error, extensions    from tortoisehg.util import hglib, settings, paths, wconfig, i18n, bugtraq  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, qscilib, thgrepo    from PyQt4.QtCore import *  from PyQt4.QtGui import *    # Technical Debt  # stacked widget or pages need to be scrollable  # we need a consistent icon set  # connect to thgrepo.configChanged signal and refresh    _unspecstr = _('<unspecified>')  ENTRY_WIDTH = 300   +def hasExtension(extname): + for name, module in extensions.extensions(): + if name == extname: + return True + return False +  class SettingsCombo(QComboBox):   def __init__(self, parent=None, **opts):   QComboBox.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.setEditable(opts.get('canedit', False))   self.setValidator(opts.get('validator', None))   self.defaults = opts.get('defaults', [])   if self.defaults and self.isEditable():   self.setCompleter(QCompleter(self.defaults, self))   self.curvalue = None   self.loaded = False   if 'nohist' in opts:   self.previous = []   else:   settings = opts['settings']   slist = settings.value('settings/'+opts['cpath']).toStringList()   self.previous = [s for s in slist if s]   self.setMinimumWidth(ENTRY_WIDTH)     def resetList(self):   self.clear()   ucur = hglib.tounicode(self.curvalue)   if self.opts.get('defer') and not self.loaded:   if self.curvalue == None: # unspecified   self.addItem(_unspecstr)   else:   self.addItem(ucur or '...')   return   self.addItem(_unspecstr)   curindex = None   for s in self.defaults:   if ucur == s:   curindex = self.count()   self.addItem(s)   if self.defaults and self.previous:   self.insertSeparator(len(self.defaults)+1)   for m in self.previous:   if ucur == m and not curindex:   curindex = self.count()   self.addItem(m)   if curindex is not None:   self.setCurrentIndex(curindex)   elif self.curvalue is None:   self.setCurrentIndex(0)   elif self.curvalue:   self.addItem(ucur)   self.setCurrentIndex(self.count()-1)   else: # empty string   self.setEditText(ucur)     def showPopup(self):   if self.opts.get('defer') and not self.loaded:   self.defaults = self.opts['defer']()   self.loaded = True   self.resetList()   QComboBox.showPopup(self)     ## common APIs for all edit widgets     def setValue(self, curvalue):   self.curvalue = curvalue   self.resetList()     def value(self):   utext = self.currentText()   if utext == _unspecstr:   return None   if 'nohist' in self.opts or utext in self.defaults + self.previous or not utext:   return hglib.fromunicode(utext)   self.previous.insert(0, utext)   self.previous = self.previous[:10]   settings = QSettings()   settings.setValue('settings/'+self.opts['cpath'], self.previous)   return hglib.fromunicode(utext)     def isDirty(self):   return self.value() != self.curvalue    class BoolRBGroup(QWidget):   def __init__(self, parent=None, **opts):   QWidget.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None     self.trueRB = QRadioButton(_('&True'))   self.falseRB = QRadioButton(_('&False'))   self.unspecRB = QRadioButton(_('&Unspecified'))     layout = QHBoxLayout()   layout.setContentsMargins(0, 0, 0, 0)   layout.addWidget(self.trueRB)   layout.addWidget(self.falseRB)   layout.addWidget(self.unspecRB)   self.setLayout(layout)     ## common APIs for all edit widgets   def setValue(self, curvalue):   self.curvalue = curvalue   if curvalue == 'True':   self.trueRB.setChecked(True)   elif curvalue == 'False':   self.falseRB.setChecked(True)   else:   self.unspecRB.setChecked(True)     def value(self):   if self.trueRB.isChecked():   return 'True'   elif self.falseRB.isChecked():   return 'False'   else:   return None     def isDirty(self):   return self.value() != self.curvalue    class PasswordEntry(QLineEdit):   def __init__(self, parent=None, **opts):   QLineEdit.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None   self.setEchoMode(QLineEdit.Password)   self.setMinimumWidth(ENTRY_WIDTH)     ## common APIs for all edit widgets   def setValue(self, curvalue):   self.curvalue = curvalue   if curvalue:   self.setText(hglib.tounicode(curvalue))   else:   self.setText('')     def value(self):   utext = self.text()   return utext and hglib.fromunicode(utext) or None     def isDirty(self):   return self.value() != self.curvalue    class FontEntry(QWidget):   def __init__(self, parent=None, **opts):   QWidget.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None     self.label = QLabel()   self.setButton = QPushButton(_('&Set...'))   self.clearButton = QPushButton(_('&Clear'))     layout = QHBoxLayout()   layout.setContentsMargins(0, 0, 0, 0)   layout.addWidget(self.label)   layout.addStretch()   layout.addWidget(self.setButton)   layout.addWidget(self.clearButton)   self.setLayout(layout)     self.setButton.clicked.connect(self.onSetClicked)   self.clearButton.clicked.connect(self.onClearClicked)     cpath = self.opts['cpath']   assert cpath.startswith('tortoisehg.')   self.fname = cpath[11:]   self.setMinimumWidth(ENTRY_WIDTH)     def onSetClicked(self, checked):   def newFont(font):   self.setText(font.toString())   thgf.setFont(font)   thgf = qtlib.getfont(self.fname)   origfont = self.currentFont() or thgf.font()   dlg = QFontDialog(self)   dlg.currentFontChanged.connect(newFont)   font, isok = dlg.getFont(origfont, self)   if not isok:   return   self.label.setText(font.toString())   thgf.setFont(font)     def onClearClicked(self, checked):   self.label.setText(_unspecstr)     def currentFont(self):   """currently selected QFont if specified"""   if not self.value():   return None     f = QFont()   f.fromString(self.value())   return f     ## common APIs for all edit widgets     def setValue(self, curvalue):   self.curvalue = curvalue   if curvalue:   self.label.setText(hglib.tounicode(curvalue))   else:   self.label.setText(_unspecstr)     def value(self):   utext = self.label.text()   if utext == _unspecstr:   return None   else:   return hglib.fromunicode(utext)     def isDirty(self):   return self.value() != self.curvalue    class SettingsCheckBox(QCheckBox):   def __init__(self, parent=None, **opts):   QCheckBox.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None   self.setText(opts['label'])   self.valfunc = self.opts['valfunc']   self.toggled.connect(self.valfunc)     def setValue(self, curvalue):   if self.curvalue == None:   self.curvalue = curvalue   self.setChecked(curvalue)     def value(self):   return self.isChecked()     def isDirty(self):   return self.value() != self.curvalue      class BugTraqConfigureEntry(QPushButton):   def __init__(self, parent=None, **opts):   QPushButton.__init__(self, parent, toolTip=opts['tooltip'])     self.opts = opts   self.curvalue = None   self.options = None     self.tracker = None   self.master = None   self.setText(opts['label'])   self.clicked.connect(self.on_clicked)     def on_clicked(self, checked):   parameters = self.options   self.options = self.tracker.show_options_dialog(parameters)     def master_updated(self):   self.setEnabled(False)   if self.master == None:   return   if self.master.value() == None:   return   if len(self.master.value()) == 0:   return     try:   setting = self.master.value().split(' ', 1)   trackerid = setting[0]   name = setting[1]   self.tracker = bugtraq.BugTraq(trackerid)   except:   # failed to load bugtraq module or parse the setting:   # swallow the error and leave the widget disabled   return     try:   self.setEnabled(self.tracker.has_options())   except Exception, e:   qtlib.ErrorMsgBox(_('Issue Tracker'),   _('Failed to load issue tracker: \'%s\': %s. '   % (name, e)),   parent=self)     ## common APIs for all edit widgets   def setValue(self, curvalue):   if self.master == None:   self.master = self.opts['master']   self.master.currentIndexChanged.connect(self.master_updated)   self.master_updated()   self.curvalue = curvalue   self.options = curvalue     def value(self):   return self.options     def isDirty(self):   return self.value() != self.curvalue     +class PathBrowser(QWidget): + def __init__(self, parent=None, **opts): + QWidget.__init__(self, parent, toolTip=opts['tooltip']) + self.opts = opts + + self.lineEdit = QLineEdit() + completer = QCompleter(self) + completer.setModel(QDirModel(completer)) + self.lineEdit.setCompleter(completer) + + self.browseButton = QPushButton(_('&Browse...')) + self.browseButton.clicked.connect(self.browse) + + layout = QHBoxLayout() + layout.setContentsMargins(0, 0, 0, 0) + layout.addWidget(self.lineEdit) + layout.addWidget(self.browseButton) + self.setLayout(layout) + + def browse(self): + dir = QFileDialog.getExistingDirectory(self, directory=self.lineEdit.text(), + options=QFileDialog.ShowDirsOnly) + if dir: + self.lineEdit.setText(dir) + + ## common APIs for all edit widgets + def setValue(self, curvalue): + self.curvalue = curvalue + if curvalue: + self.lineEdit.setText(hglib.tounicode(curvalue)) + else: + self.lineEdit.setText('') + + def value(self): + utext = self.lineEdit.text() + return utext and hglib.fromunicode(utext) or None + + def isDirty(self): + return self.value() != self.curvalue +  def genEditCombo(opts, defaults=[]):   opts['canedit'] = True   opts['defaults'] = defaults   return SettingsCombo(**opts)    def genIntEditCombo(opts):   'EditCombo, only allows integer values'   opts['canedit'] = True   opts['validator'] = QIntValidator()   return SettingsCombo(**opts)    def genPasswordEntry(opts):   'Generate a password entry box'   return PasswordEntry(**opts)    def genDefaultCombo(opts, defaults=[]):   'user must select from a list'   opts['defaults'] = defaults   opts['nohist'] = True   return SettingsCombo(**opts)    def genBoolRBGroup(opts):   'true, false, unspecified'   return BoolRBGroup(**opts)    def genDeferredCombo(opts, func):   'Values retrieved from a function at popup time'   opts['defer'] = func   opts['nohist'] = True   return SettingsCombo(**opts)    def genFontEdit(opts):   return FontEntry(**opts)    def genBugTraqEdit(opts):   return BugTraqConfigureEntry(**opts)   +def genPathBrowser(opts): + return PathBrowser(**opts) +  def findIssueTrackerPlugins():   plugins = bugtraq.get_issue_plugins_with_names()   names = [("%s %s" % (key[0], key[1])) for key in plugins]   return names    def issuePluginVisible():   try:   # quick test to see if we're able to load the bugtraq module   test = bugtraq.BugTraq('')   return True   except:   return False    def findDiffTools():   return hglib.difftools(ui.ui())    def findMergeTools():   return hglib.mergetools(ui.ui())    def genCheckBox(opts):   opts['nohist'] = True   return SettingsCheckBox(**opts)    class _fi(object):   """Information of each field"""   __slots__ = ('label', 'cpath', 'values', 'tooltip',   'restartneeded', 'globalonly',   'master', 'visible')     def __init__(self, label, cpath, values, tooltip,   restartneeded=False, globalonly=False,   master=None, visible=None):   self.label = label   self.cpath = cpath   self.values = values   self.tooltip = tooltip   self.restartneeded = restartneeded   self.globalonly = globalonly   self.master = master   self.visible = visible     def isVisible(self):   if self.visible == None:   return True   else:   return self.visible()    INFO = (  ({'name': 'general', 'label': 'TortoiseHg', 'icon': 'thg_logo'}, (   _fi(_('UI Language'), 'tortoisehg.ui.language',   (genDeferredCombo, i18n.availablelanguages),   _('Specify your preferred user interface language (restart needed)'),   restartneeded=True, globalonly=True),   _fi(_('Three-way Merge Tool'), 'ui.merge',   (genDeferredCombo, findMergeTools),   _('Graphical merge program for resolving merge conflicts. If left '   'unspecified, Mercurial will use the first applicable tool it finds '   'on your system or use its internal merge tool that leaves conflict '   'markers in place. Chose internal:merge to force conflict markers ,'   'internal:prompt to always select local or other, or internal:dump '   'to leave files in the working directory for manual merging')),   _fi(_('Visual Diff Tool'), 'tortoisehg.vdiff',   (genDeferredCombo, findDiffTools),   _('Specify visual diff tool, as described in the [merge-tools] '   'section of your Mercurial configuration files. If left '   'unspecified, TortoiseHg will use the selected merge tool. '   'Failing that it uses the first applicable tool it finds.')),   _fi(_('Visual Editor'), 'tortoisehg.editor', genEditCombo,   _('Specify the visual editor used to view files. Format:<br>'   'myeditor -flags [$FILE --num=$LINENUM][--search $SEARCH]<br><br>'   'See <a href="%s">OpenAtLine</a>'   % 'http://bitbucket.org/tortoisehg/thg/wiki/OpenAtLine')),   _fi(_('Shell'), 'tortoisehg.shell', genEditCombo,   _('Specify the command to launch your preferred terminal shell '   'application. If the value includes the string %(reponame)s, the '   'name of the repository will be substituted in place of '   '%(reponame)s. (restart needed)<br>'   'Default, Windows: cmd.exe /K title %(reponame)s<br>'   'Default, OS X: not set<br>'   'Default, other: xterm -T "%(reponame)s"'),   globalonly=True),   _fi(_('Immediate Operations'), 'tortoisehg.immediate', genEditCombo,   _('Space separated list of shell operations you would like '   'to be performed immediately, without user interaction. '   'Commands are "add remove revert forget". '   'Default: None (leave blank)')),   _fi(_('Tab Width'), 'tortoisehg.tabwidth', genIntEditCombo,   _('Specify the number of spaces that tabs expand to in various '   'TortoiseHg windows. '   'Default: 0, Not expanded')),   _fi(_('Force Repo Tab'), 'tortoisehg.forcerepotab', genBoolRBGroup,   _('Always show repo tabs, even for a single repo. Default: False')),   _fi(_('Monitor Repo Changes'), 'tortoisehg.monitorrepo',   (genDefaultCombo, ['always', 'localonly']),   _('Specify the target filesystem where TortoiseHg monitors changes. '   'Default: always')),   _fi(_('Max Diff Size'), 'tortoisehg.maxdiff', genIntEditCombo,   _('The maximum size file (in KB) that TortoiseHg will '   'show changes for in the changelog, status, and commit windows. '   'A value of zero implies no limit. Default: 1024 (1MB)')),   _fi(_('Fork GUI'), 'tortoisehg.guifork', genBoolRBGroup,   _('When running from the command line, fork a background '   'process to run graphical dialogs. Default: True')),   _fi(_('Full Path Title'), 'tortoisehg.fullpath', genBoolRBGroup,   _('Show a full directory path of the repository in the dialog title '   'instead of just the root directory name. Default: False')),   _fi(_('Auto-resolve merges'), 'tortoisehg.autoresolve', genBoolRBGroup,   _('Indicates whether TortoiseHg should attempt to automatically '   'resolve changes from both sides to the same file, and only report '   'merge conflicts when this is not possible. When False, all files '   'with changes on both sides of the merge will report as conflicting, '   'even if the edits are to different parts of the file. In either '   'case, when conflicts occur, the user will be invited to review and '   'resolve changes manually. Default: False.')),   )),    ({'name': 'log', 'label': _('Workbench'), 'icon': 'menulog'}, (   _fi(_('Default widget'), 'tortoisehg.defaultwidget', (genDefaultCombo,   ['revdetails', 'commit', 'mq', 'sync', 'manifest', 'search']),   _('Select the initial widget that will be shown when opening a '   'repository. '   'Default: revdetails')),   _fi(_('Initial revision'), 'tortoisehg.initialrevision', (genDefaultCombo,   ['current', 'tip', 'workingdir']),   _('Select the initial revision that will be selected when opening a '   'repository. You can select the "current" (i.e. the working directory '   'parent), the current "tip" or the working directory ("workingdir"). '   'Default: current')),   _fi(_('Author Coloring'), 'tortoisehg.authorcolor', genBoolRBGroup,   _('Color changesets by author name. If not enabled, '   'the changes are colored green for merge, red for '   'non-trivial parents, black for normal. '   'Default: False')),   _fi(_('Task Tabs'), 'tortoisehg.tasktabs', (genDefaultCombo,   ['east', 'west', 'off']),   _('Show tabs along the side of the bottom half of each repo '   'widget allowing one to switch task tabs without using the toolbar. '   'Default: off')),   _fi(_('Long Summary'), 'tortoisehg.longsummary', genBoolRBGroup,   _('If true, concatenate multiple lines of changeset summary '   'until they reach 80 characters. '   'Default: False')),   _fi(_('Log Batch Size'), 'tortoisehg.graphlimit', genIntEditCombo,   _('The number of revisions to read and display in the '   'changelog viewer in a single batch. '   'Default: 500')),   _fi(_('Dead Branches'), 'tortoisehg.deadbranch', genEditCombo,   _('Comma separated list of branch names that should be ignored '   'when building a list of branch names for a repository. '   'Default: None (leave blank)')),   _fi(_('Branch Colors'), 'tortoisehg.branchcolors', genEditCombo,   _('Space separated list of branch names and colors of the form '   'branch:#XXXXXX. Spaces and colons in the branch name must be '   'escaped using a backslash (\\). Likewise some other characters '   'can be escaped in this way, e.g. \\u0040 will be decoded to the '   '@ character, and \\n to a linefeed. '   'Default: None (leave blank)')),   _fi(_('Hide Tags'), 'tortoisehg.hidetags', genEditCombo,   _('Space separated list of tags that will not be shown.'   'Useful example: Specify "qbase qparent qtip" to hide the '   'standard tags inserted by the Mercurial Queues Extension. '   'Default: None (leave blank)')),   _fi(_('After Pull Operation'), 'tortoisehg.postpull', (genDefaultCombo,   ['none', 'update', 'fetch', 'rebase']),   _('Operation which is performed directly after a successful pull. '   'update equates to pull --update, fetch equates to the fetch '   'extension, rebase equates to pull --rebase. Default: none')),   )),    ({'name': 'commit', 'label': _('Commit', 'config item'), 'icon': 'menucommit'}, (   _fi(_('Username'), 'ui.username', genEditCombo,   _('Name associated with commits. The common format is:<br>'   'Full Name &lt;email@example.com&gt;')),   _fi(_('Summary Line Length'), 'tortoisehg.summarylen', genIntEditCombo,   _('Suggested length of commit message lines. A red vertical '   'line will mark this length. CTRL-E will reflow the current '   'paragraph to the specified line length. Default: 80')),   _fi(_('Close After Commit'), 'tortoisehg.closeci', genBoolRBGroup,   _('Close the commit tool after every successful '   'commit. Default: False')),   _fi(_('Push After Commit'), 'tortoisehg.cipushafter', (genEditCombo,   ['default-push', 'default']),   _('Attempt to push to specified URL or alias after each successful '   'commit. Default: No push')),   _fi(_('Auto Commit List'), 'tortoisehg.autoinc', genEditCombo,   _('Comma separated list of files that are automatically included '   'in every commit. Intended for use only as a repository setting. '   'Default: None (leave blank)')),   _fi(_('Auto Exclude List'), 'tortoisehg.ciexclude', genEditCombo,   _('Comma separated list of files that are automatically unchecked '   'when the status, and commit dialogs are opened. '   'Default: None (leave blank)')),   _fi(_('English Messages'), 'tortoisehg.engmsg', genBoolRBGroup,   _('Generate English commit messages even if LANGUAGE or LANG '   'environment variables are set to a non-English language. '   'This setting is used by the Merge, Tag and Backout dialogs. '   'Default: False')),   )),    ({'name': 'web', 'label': _('Web Server'), 'icon': 'proxy'}, (   _fi(_('Name'), 'web.name', genEditCombo,   _('Repository name to use in the web interface, and by TortoiseHg '   'as a shorthand name. Default is the working directory.')),   _fi(_('Description'), 'web.description', genEditCombo,   _("Textual description of the repository's purpose or "   'contents.')),   _fi(_('Contact'), 'web.contact', genEditCombo,   _('Name or email address of the person in charge of the '   'repository.')),   _fi(_('Style'), 'web.style', (genDefaultCombo,   ['paper', 'monoblue', 'coal', 'spartan', 'gitweb', 'old']),   _('Which template map style to use')),   _fi(_('Archive Formats'), 'web.allow_archive',   (genEditCombo, ['bz2', 'gz', 'zip']),   _('Comma separated list of archive formats allowed for '   'downloading')),   _fi(_('Port'), 'web.port', genIntEditCombo, _('Port to listen on')),   _fi(_('Push Requires SSL'), 'web.push_ssl', genBoolRBGroup,   _('Whether to require that inbound pushes be transported '   'over SSL to prevent password sniffing.')),   _fi(_('Stripes'), 'web.stripes', genIntEditCombo,   _('How many lines a "zebra stripe" should span in multiline output. '   'Default is 1; set to 0 to disable.')),   _fi(_('Max Files'), 'web.maxfiles', genIntEditCombo,   _('Maximum number of files to list per changeset. Default: 10')),   _fi(_('Max Changes'), 'web.maxchanges', genIntEditCombo,   _('Maximum number of changes to list on the changelog. '   'Default: 10')),   _fi(_('Allow Push'), 'web.allow_push', (genEditCombo, ['*']),   _('Whether to allow pushing to the repository. If empty or not '   'set, push is not allowed. If the special value "*", any remote '   'user can push, including unauthenticated users. Otherwise, the '   'remote user must have been authenticated, and the authenticated '   'user name must be present in this list (separated by whitespace '   'or ","). The contents of the allow_push list are examined after '   'the deny_push list.')),   _fi(_('Deny Push'), 'web.deny_push', (genEditCombo, ['*']),   _('Whether to deny pushing to the repository. If empty or not set, '   'push is not denied. If the special value "*", all remote users '   'are denied push. Otherwise, unauthenticated users are all '   'denied, and any authenticated user name present in this list '   '(separated by whitespace or ",") is also denied. The contents '   'of the deny_push list are examined before the allow_push list.')),   _fi(_('Encoding'), 'web.encoding', (genEditCombo, ['UTF-8']),   _('Character encoding name')),   )),    ({'name': 'proxy', 'label': _('Proxy'), 'icon': QStyle.SP_DriveNetIcon}, (   _fi(_('Host'), 'http_proxy.host', genEditCombo,   _('Host name and (optional) port of proxy server, for '   'example "myproxy:8000"')),   _fi(_('Bypass List'), 'http_proxy.no', genEditCombo,   _('Optional. Comma-separated list of host names that '   'should bypass the proxy')),   _fi(_('User'), 'http_proxy.user', genEditCombo,   _('Optional. User name to authenticate with at the proxy server')),   _fi(_('Password'), 'http_proxy.passwd', genPasswordEntry,   _('Optional. Password to authenticate with at the proxy server')),   )),    ({'name': 'email', 'label': _('Email'), 'icon': 'mail-forward'}, (   _fi(_('From'), 'email.from', genEditCombo,   _('Email address to use in the "From" header and for '   'the SMTP envelope')),   _fi(_('To'), 'email.to', genEditCombo,   _('Comma-separated list of recipient email addresses')),   _fi(_('Cc'), 'email.cc', genEditCombo,   _('Comma-separated list of carbon copy recipient email addresses')),   _fi(_('Bcc'), 'email.bcc', genEditCombo,   _('Comma-separated list of blind carbon copy recipient '   'email addresses')),   _fi(_('method'), 'email.method', (genEditCombo, ['smtp']),   _('Optional. Method to use to send email messages. If value is '   '"smtp" (default), use SMTP (configured below). Otherwise, use as '   'name of program to run that acts like sendmail (takes "-f" option '   'for sender, list of recipients on command line, message on stdin). '   'Normally, setting this to "sendmail" or "/usr/sbin/sendmail" '   'is enough to use sendmail to send messages.')),   _fi(_('SMTP Host'), 'smtp.host', genEditCombo,   _('Host name of mail server')),   _fi(_('SMTP Port'), 'smtp.port', genIntEditCombo,   _('Port to connect to on mail server. '   'Default: 25')),   _fi(_('SMTP TLS'), 'smtp.tls', genBoolRBGroup,   _('Connect to mail server using TLS. '   'Default: False')),   _fi(_('SMTP Username'), 'smtp.username', genEditCombo,   _('Username to authenticate to mail server with')),   _fi(_('SMTP Password'), 'smtp.password', genPasswordEntry,   _('Password to authenticate to mail server with')),   _fi(_('Local Hostname'), 'smtp.local_hostname', genEditCombo,   _('Hostname the sender can use to identify itself to the '   'mail server.')),   )),    ({'name': 'diff', 'label': _('Diff'),   'icon': QStyle.SP_FileDialogContentsView}, (   _fi(_('Patch EOL'), 'patch.eol', (genDefaultCombo,   ['auto', 'strict', 'crlf', 'lf']),   _('Normalize file line endings during and after patch to lf or '   'crlf. Strict does no normalization. Auto does per-file '   'detection, and is the recommended setting. '   'Default: strict')),   _fi(_('Git Format'), 'diff.git', genBoolRBGroup,   _('Use git extended diff header format. '   'Default: False')),   _fi(_('MQ Git Format'), 'mq.git', (genDefaultCombo,   ['auto', 'keep', 'yes', 'no']),   _("If set to 'keep', mq will obey the [diff] section configuration while"   " preserving existing git patches upon qrefresh. If set to 'yes' or"   " 'no', mq will override the [diff] section and always generate git or"   " regular patches, possibly losing data in the second case.")),   _fi(_('No Dates'), 'diff.nodates', genBoolRBGroup,   _('Do not include modification dates in diff headers. '   'Default: False')),   _fi(_('Show Function'), 'diff.showfunc', genBoolRBGroup,   _('Show which function each change is in. '   'Default: False')),   _fi(_('Ignore White Space'), 'diff.ignorews', genBoolRBGroup,   _('Ignore white space when comparing lines. '   'Default: False')),   _fi(_('Ignore WS Amount'), 'diff.ignorewsamount', genBoolRBGroup,   _('Ignore changes in the amount of white space. '   'Default: False')),   _fi(_('Ignore Blank Lines'), 'diff.ignoreblanklines', genBoolRBGroup,   _('Ignore changes whose lines are all blank. '   'Default: False')),   )),    ({'name': 'fonts', 'label': _('Fonts'), 'icon': 'preferences-desktop-font'}, (   _fi(_('Message Font'), 'tortoisehg.fontcomment', genFontEdit,   _('Font used to display commit messages. Default: monospace 10'),   globalonly=True),   _fi(_('Diff Font'), 'tortoisehg.fontdiff', genFontEdit,   _('Font used to display text differences. Default: monospace 10'),   globalonly=True),   _fi(_('List Font'), 'tortoisehg.fontlist', genFontEdit,   _('Font used to display file lists. Default: sans 9'),   globalonly=True),   _fi(_('ChangeLog Font'), 'tortoisehg.fontlog', genFontEdit,   _('Font used to display changelog data. Default: monospace 10'),   globalonly=True),   _fi(_('Output Font'), 'tortoisehg.fontoutputlog', genFontEdit,   _('Font used to display output messages. Default: sans 8'),   globalonly=True),   )),    ({'name': 'extensions', 'label': _('Extensions'), 'icon': 'hg-extensions'}, (   )),    ({'name': 'issue', 'label': _('Issue Tracking'), 'icon': 'edit-file'}, (   _fi(_('Issue Regex'), 'tortoisehg.issue.regex', genEditCombo,   _('Defines the regex to match when picking up issue numbers.')),   _fi(_('Issue Link'), 'tortoisehg.issue.link', genEditCombo,   _('Defines the command to run when an issue number is recognized. '   'You may include groups in issue.regex, and corresponding {n} '   'tokens in issue.link (where n is a non-negative integer). '   '{0} refers to the entire string matched by issue.regex, '   'while {1} refers to the first group and so on. If no {n} tokens'   'are found in issue.link, the entire matched string is appended '   'instead.')), + _fi(_('Mandatory Issue Reference'), 'tortoisehg.issue.linkmandatory', genBoolRBGroup, + _('When committing, require that a reference to an issue be specified. ' + 'If enabled, the regex configured in \'Issue Regex\' must find a match ' + 'in the commit message.')),   _fi(_('Issue Tracker Plugin'), 'tortoisehg.issue.bugtraqplugin',   (genDeferredCombo, findIssueTrackerPlugins),   _('Configures a COM IBugTraqProvider or IBugTrackProvider2 issue '   'tracking plugin.'), visible=issuePluginVisible),   _fi(_('Configure Issue Tracker'), 'tortoisehg.issue.bugtraqparameters', genBugTraqEdit,   _('Configure the selected COM Bug Tracker plugin.'),   master='tortoisehg.issue.bugtraqplugin', visible=issuePluginVisible),   )),    ({'name': 'reviewboard', 'label': _('Review Board'), 'icon': 'reviewboard'}, (   _fi(_('Server'), 'reviewboard.server', genEditCombo,   _('Path to review board '   'example "http://demo.reviewboard.org"')),   _fi(_('User'), 'reviewboard.user', genEditCombo,   _('User name to authenticate with review board')),   _fi(_('Password'), 'reviewboard.password', genPasswordEntry,   _('Password to authenticate with review board')),   _fi(_('Server Repository ID'), 'reviewboard.repoid', genEditCombo,   _('The default repository id for this repo on the review board server')),   _fi(_('Target Groups'), 'reviewboard.target_groups', genEditCombo,   _('A comma separated list of target groups')),   _fi(_('Target People'), 'reviewboard.target_people', genEditCombo,   _('A comma separated list of target people')),   )), + +({'name': 'kbfiles', 'label': _('Kiln Bfiles'), 'icon': 'kiln', 'extension': 'kbfiles'}, ( + _fi(_('Patterns'), 'kilnbfiles.patterns', genEditCombo, + _('Files with names meeting the specified patterns will be automatically ' + 'added as bfiles')), + _fi(_('Size'), 'kilnbfiles.size', genEditCombo, + _('Files of at least the specified size (in megabytes) will be added as bfiles')), + _fi(_('System Cache'), 'kilnbfiles.systemcache', genPathBrowser, + _('Path to the directory where a system-wide cache of bfiles will be stored')), + )), + +({'name': 'largefiles', 'label': _('Largefiles'), 'icon': 'kiln', 'extension': 'largefiles'}, ( + _fi(_('Patterns'), 'largefiles.patterns', genEditCombo, + _('Files with names meeting the specified patterns will be automatically ' + 'added as largefiles')), + _fi(_('Size'), 'largefiles.size', genEditCombo, + _('Files of at least the specified size (in megabytes) will be added as largefiles')), + _fi(_('System Cache'), 'largefiles.systemcache', genPathBrowser, + _('Path to the directory where a system-wide cache of largefiles will be stored')), + )),    )    CONF_GLOBAL = 0  CONF_REPO = 1    class SettingsDialog(QDialog):   'Dialog for editing Mercurial.ini or hgrc'   def __init__(self, configrepo=False, focus=None, parent=None, root=None):   QDialog.__init__(self, parent)   self.setWindowTitle(_('TortoiseHg Settings'))   self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)   self.setWindowIcon(qtlib.geticon('settings_repo'))     if not hasattr(wconfig.config(), 'write'):   qtlib.ErrorMsgBox(_('Iniparse package not found'),   _("Can't change settings without iniparse package - "   'view is readonly.'), parent=self)   print 'Please install http://code.google.com/p/iniparse/'     layout = QVBoxLayout()   self.setLayout(layout)     s = QSettings()   self.settings = s   self.restoreGeometry(s.value('settings/geom').toByteArray())     def username():   name = util.username()   if name:   return hglib.tounicode(name)   name = os.environ.get('USERNAME')   if name:   return hglib.tounicode(name)   return _('User')     self.conftabs = QTabWidget()   layout.addWidget(self.conftabs)   utab = SettingsForm(rcpath=hglib.user_rcpath(), focus=focus)   self.conftabs.addTab(utab, qtlib.geticon('settings_user'),   _("%s's global settings") % username())   utab.restartRequested.connect(self._pushRestartRequest)     try:   if root is None:   root = paths.find_root()   if root:   repo = thgrepo.repository(ui.ui(), root)   else:   repo = None   except error.RepoError:   repo = None   if configrepo:   uroot = hglib.tounicode(root)   qtlib.ErrorMsgBox(_('No repository found'),   _('no repo at ') + uroot, parent=self)     if repo:   reporcpath = os.sep.join([repo.root, '.hg', 'hgrc'])   rtab = SettingsForm(rcpath=reporcpath, focus=focus)   self.conftabs.addTab(rtab, qtlib.geticon('settings_repo'),   _('%s repository settings') % repo.displayname)   rtab.restartRequested.connect(self._pushRestartRequest)     BB = QDialogButtonBox   bb = QDialogButtonBox(BB.Ok|BB.Cancel)   bb.accepted.connect(self.accept)   bb.rejected.connect(self.reject)   layout.addWidget(bb)   self.bb = bb     self._restartreqs = set()     self.conftabs.setCurrentIndex(configrepo and CONF_REPO or CONF_GLOBAL)     def isDirty(self):   return util.any(self.conftabs.widget(i).isDirty()   for i in xrange(self.conftabs.count()))     @pyqtSlot(unicode)   def _pushRestartRequest(self, key):   self._restartreqs.add(unicode(key))     def applyChanges(self):   for i in xrange(self.conftabs.count()):   self.conftabs.widget(i).applyChanges()   if self._restartreqs:   qtlib.InfoMsgBox(_('Settings'),   _('Restart all TortoiseHg applications '   'for the following changes to take effect:'),   ', '.join(sorted(self._restartreqs)))   self._restartreqs.clear()     def canExit(self):   if self.isDirty():   ret = qtlib.CustomPrompt(_('Confirm Exit'),   _('Apply changes before exit?'), self,   (_('&Yes'), _('&No (discard changes)'),   _ ('Cancel')), default=2, esc=2).run()   if ret == 2:   return False   elif ret == 0:   self.applyChanges()   return True   return True     def accept(self):   self.applyChanges()   s = self.settings   s.setValue('settings/geom', self.saveGeometry())   s.sync()   QDialog.accept(self)     def reject(self):   if not self.canExit():   return   s = self.settings   s.setValue('settings/geom', self.saveGeometry())   s.sync()   QDialog.reject(self)    class SettingsForm(QWidget):   """Widget for each settings file"""     restartRequested = pyqtSignal(unicode)     def __init__(self, rcpath, focus=None, parent=None):   super(SettingsForm, self).__init__(parent)     if isinstance(rcpath, (list, tuple)):   self.rcpath = rcpath   else:   self.rcpath = [rcpath]     layout = QVBoxLayout()   self.setLayout(layout)     tophbox = QHBoxLayout()   layout.addLayout(tophbox)     self.fnedit = QLineEdit()   self.fnedit.setReadOnly(True)   self.fnedit.setFrame(False)   self.fnedit.setFocusPolicy(Qt.NoFocus)   self.fnedit.setStyleSheet('QLineEdit { background: transparent; }')   edit = QPushButton(_('Edit File'))   edit.clicked.connect(self.editClicked)   self.editbtn = edit   reload = QPushButton(_('Reload'))   reload.clicked.connect(self.reloadClicked)   self.reloadbtn = reload   tophbox.addWidget(QLabel(_('Settings File:')))   tophbox.addWidget(self.fnedit)   tophbox.addWidget(edit)   tophbox.addWidget(reload)     bothbox = QHBoxLayout()   layout.addLayout(bothbox, stretch=8)   pageList = QListWidget()   pageList.setResizeMode(QListView.Fixed)   stack = QStackedWidget()   bothbox.addWidget(pageList, 0)   bothbox.addWidget(stack, 1)   pageList.currentRowChanged.connect(self.activatePage)     self.pages = {}   self.stack = stack   self.pageList = pageList     desctext = QTextBrowser()   desctext.setOpenExternalLinks(True)   layout.addWidget(desctext, stretch=2)   self.desctext = desctext     self.settings = QSettings()     # add page items to treeview   for meta, info in INFO: + if 'extension' in meta and not hasExtension(meta['extension']): + continue   if isinstance(meta['icon'], str):   icon = qtlib.geticon(meta['icon'])   else:   style = QApplication.style()   icon = QIcon()   icon.addPixmap(style.standardPixmap(meta['icon']))   item = QListWidgetItem(icon, meta['label'])   pageList.addItem(item)     self.refresh()   self.focusField(focus or 'ui.merge')     def activatePage(self, index):   item = self.pageList.currentItem()   for data in INFO:   if item.text() == data[0]['label']:   meta, info = data   break     pagename = meta['name']   if self.pages.has_key(pagename):   page = self.pages[pagename]   else:   page = self.createPage(pagename, info)   self.refreshPage(page)   frame = page[2][0].parentWidget()   self.stack.setCurrentWidget(frame)     def editClicked(self):   'Open internal editor in stacked widget'   if self.isDirty():   ret = qtlib.CustomPrompt(_('Confirm Save'),   _('Save changes before editing?'), self,   (_('&Save'), _('&Discard'), _('Cancel')),   default=2, esc=2).run()   if ret == 0:   self.applyChanges()   elif ret == 2:   return   if qscilib.fileEditor(self.fn, foldable=True) == QDialog.Accepted:   self.refresh()     def refresh(self, *args):   # refresh config values   self.ini = self.loadIniFile(self.rcpath)   self.readonly = not (hasattr(self.ini, 'write')   and os.access(self.fn, os.W_OK))   self.stack.setDisabled(self.readonly)   self.fnedit.setText(hglib.tounicode(self.fn))   for page in self.pages.values():   self.refreshPage(page)     def refreshPage(self, page):   name, info, widgets = page   if name == 'extensions':   extsmentioned = False   for row, w in enumerate(widgets):   key = w.opts['label']   for fullkey in (key, 'hgext.%s' % key, 'hgext/%s' % key):   val = self.readCPath('extensions.' + fullkey)   if val != None:   break   if val == None:   curvalue = False   elif len(val) and val[0] == '!':   curvalue = False   extsmentioned = True   else:   curvalue = True   extsmentioned = True   w.setValue(curvalue)   if val == None:   w.opts['cpath'] = 'extensions.' + key   else:   w.opts['cpath'] = 'extensions.' + fullkey   if not extsmentioned:   # make sure widgets are shown properly,   # even when no extensions mentioned in the config file   self.validateextensions()   else:   for row, e in enumerate(info):   curvalue = self.readCPath(e.cpath)   widgets[row].setValue(curvalue)     def isDirty(self):   if self.readonly:   return False   for name, info, widgets in self.pages.values():   for w in widgets:   if w.isDirty():   return True   return False     def reloadClicked(self):   if self.isDirty():   d = QMessageBox.question(self, _('Confirm Reload'),   _('Unsaved changes will be lost.\n'   'Do you want to reload?'),   QMessageBox.Ok | QMessageBox.Cancel)   if d != QMessageBox.Ok:   return   self.refresh()     def focusField(self, focusfield):   'Set page and focus to requested datum'   for i, (meta, info) in enumerate(INFO):   for n, e in enumerate(info):   if e.cpath == focusfield:   self.pageList.setCurrentRow(i)   QTimer.singleShot(0, lambda:   self.pages[meta['name']][2][n].setFocus())   return     def fillFrame(self, info):   widgets = []   frame = QFrame()   form = QFormLayout()   form.setContentsMargins(5, 5, 0, 5)   frame.setLayout(form)   self.stack.addWidget(frame)     for e in info:   opts = {'label': e.label, 'cpath': e.cpath, 'tooltip': e.tooltip,   'master': e.master, 'settings':self.settings}   if isinstance(e.values, tuple):   func = e.values[0]   w = func(opts, e.values[1])   else:   func = e.values   w = func(opts)   w.installEventFilter(self)   if e.globalonly:   w.setEnabled(self.rcpath == hglib.user_rcpath())   lbl = QLabel(e.label)   lbl.installEventFilter(self)   lbl.setToolTip(e.tooltip)   widgets.append(w)   if e.isVisible():   form.addRow(lbl, w)     # assign the master to widgets that have a master   for w in widgets:   if w.opts['master'] != None:   for dep in widgets:   if dep.opts['cpath'] == w.opts['master']:   w.opts['master'] = dep   return widgets     def fillExtensionsFrame(self):   widgets = []   frame = QFrame()   grid = QGridLayout()   grid.setContentsMargins(5, 5, 0, 5)   frame.setLayout(grid)   self.stack.addWidget(frame)   allexts = hglib.allextensions()   allextslist = list(allexts)   MAXCOLUMNS = 3   maxrows = (len(allextslist) + MAXCOLUMNS - 1) / MAXCOLUMNS   i = 0   extsinfo = ()   for i, name in enumerate(sorted(allexts)):   tt = hglib.tounicode(allexts[name])   opts = {'label':name, 'cpath':'extensions.' + name, 'tooltip':tt,   'valfunc':self.validateextensions}   w = genCheckBox(opts)   w.installEventFilter(self)   row, col = i / maxrows, i % maxrows   grid.addWidget(w, col, row)   widgets.append(w)   return extsinfo, widgets     def eventFilter(self, obj, event):   if event.type() in (QEvent.Enter, QEvent.FocusIn):   self.desctext.setHtml(obj.toolTip())   elif event.type() in (QEvent.Leave, QEvent.FocusOut):   focus = QApplication.focusWidget()   if focus is not None and hasattr(focus, 'toolTip'):   self.desctext.setHtml(focus.toolTip())   else:   self.desctext.setHtml('')   if event.type() == QEvent.ToolTip:   return True # tooltip is shown in self.desctext   return False     def createPage(self, name, info):   if name == 'extensions':   extsinfo, widgets = self.fillExtensionsFrame()   self.pages[name] = name, extsinfo, widgets   else:   widgets = self.fillFrame(info)   self.pages[name] = name, info, widgets   return self.pages[name]     def readCPath(self, cpath):   'Retrieve a value from the parsed config file'   # Presumes single section/key level depth   section, key = cpath.split('.', 1)   return self.ini.get(section, key)     def loadIniFile(self, rcpath):   for fn in rcpath:   if os.path.exists(fn):   break   else:   for fn in rcpath:   # Try to create a file from rcpath   try:   f = open(fn, 'w')   f.write('# Generated by TortoiseHg settings dialog\n')   f.close()   break   except (IOError, OSError):   pass   else:   qtlib.WarningMsgBox(_('Unable to create a Mercurial.ini file'),   _('Insufficient access rights, reverting to read-only '   'mode.'), parent=self)   from mercurial import config   self.fn = rcpath[0]   return config.config()   self.fn = fn   return wconfig.readfile(self.fn)     def recordNewValue(self, cpath, newvalue):   """Set the given value to ini; returns True if changed"""   # 'newvalue' is in local encoding   section, key = cpath.split('.', 1)   if newvalue == self.ini.get(section, key):   return False   if newvalue == None:   try:   del self.ini[section][key]   except KeyError:   pass   else:   self.ini.set(section, key, newvalue)   return True     def applyChanges(self):   if self.readonly:   return     for name, info, widgets in self.pages.values():   if name == 'extensions':   self.applyChangesForExtensions()   else:   for row, e in enumerate(info):   newvalue = widgets[row].value()   changed = self.recordNewValue(e.cpath, newvalue)   if changed and e.restartneeded:   self.restartRequested.emit(e.label)     try:   wconfig.writefile(self.ini, self.fn)   except IOError, e:   qtlib.WarningMsgBox(_('Unable to write configuration file'),   str(e), parent=self)     def applyChangesForExtensions(self):   emitChanged = False   section = 'extensions'   enabledexts = hglib.enabledextensions()   for chk in self.pages['extensions'][2]:   if (not emitChanged) and chk.isDirty():   self.restartRequested.emit(_('Extensions'))   emitChanged = True   name = chk.opts['label']   section, key = chk.opts['cpath'].split('.', 1)   newvalue = chk.value()   if newvalue and (name in enabledexts):   continue # unchanged   if newvalue:   self.ini.set(section, key, '')   else:   try:   del self.ini[section][key]   except KeyError:   pass     @pyqtSlot()   def validateextensions(self):   section = 'extensions'   enabledexts = hglib.enabledextensions()   selectedexts = set(chk.opts['label']   for chk in self.pages['extensions'][2]   if chk.isChecked())   invalidexts = hglib.validateextensions(selectedexts)     def getinival(cpath):   if section not in self.ini:   return None   sect, key = cpath.split('.', 1)   try:   return self.ini[sect][key]   except KeyError:   pass     def changable(name, cpath):   curval = getinival(cpath)   if curval not in ('', None):   # enabled or unspecified, official extensions only   return False   elif name in enabledexts and curval is None:   # re-disabling ext is not supported   return False   elif name in invalidexts and name not in selectedexts:   # disallow to enable bad exts, but allow to disable it   return False   else:   return True     allexts = hglib.allextensions()   for chk in self.pages['extensions'][2]:   name = chk.opts['label']   chk.setEnabled(changable(name, chk.opts['cpath']))   invalmsg = invalidexts.get(name)   if invalmsg:   invalmsg = invalmsg.decode('utf-8')   chk.setToolTip(invalmsg or hglib.tounicode(allexts[name]))      def run(ui, *pats, **opts):   return SettingsDialog(opts.get('alias') == 'repoconfig',   focus=opts.get('focus'))
 
11
12
13
14
 
15
16
17
 
413
414
415
416
 
417
418
419
 
434
435
436
 
 
437
 
 
438
439
440
 
446
447
448
 
 
449
 
 
450
451
452
 
 
453
 
 
454
455
456
 
11
12
13
 
14
15
16
17
 
413
414
415
 
416
417
418
419
 
434
435
436
437
438
439
440
441
442
443
444
 
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
@@ -11,7 +11,7 @@
   from tortoisehg.util import paths, hglib  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib, wctxactions, visdiff, cmdui, fileview +from tortoisehg.hgqt import qtlib, wctxactions, visdiff, cmdui, fileview, thgrepo    from PyQt4.QtCore import *  from PyQt4.QtGui import * @@ -413,7 +413,7 @@
    def __init__(self, repo, pctx, pats, opts, parent=None):   super(StatusThread, self).__init__() - self.repo = hg.repository(repo.ui, repo.root) + self.repo = thgrepo.repository(repo.ui, repo.root)   self.pctx = pctx   self.pats = pats   self.opts = opts @@ -434,7 +434,11 @@
  # status and commit only pre-check MAR files   precheckfn = lambda x: x < 4   m = hglib.match(self.repo[None], self.pats) + self.repo.bfstatus = True + self.repo.lfstatus = True   status = self.repo.status(match=m, **stopts) + self.repo.bfstatus = False + self.repo.lfstatus = False   # Record all matched files as initially checked   for i, stat in enumerate(StatusType.preferredOrder):   if stat == 'S': @@ -446,11 +450,19 @@
  wctx = context.workingctx(self.repo, changes=status)   self.patchecked = patchecked   elif self.pctx: + self.repo.bfstatus = True + self.repo.lfstatus = True   status = self.repo.status(node1=self.pctx.p1().node(), **stopts) + self.repo.bfstatus = False + self.repo.lfstatus = False   wctx = context.workingctx(self.repo, changes=status)   else:   wctx = self.repo[None] + self.repo.bfstatus = True + self.repo.lfstatus = True   wctx.status(**stopts) + self.repo.bfstatus = False + self.repo.lfstatus = False   self.wctx = wctx     wctx.dirtySubrepos = []
 
92
93
94
 
 
 
 
 
 
 
 
 
 
95
96
97
 
388
389
390
 
 
 
 
391
392
393
 
1506
1507
1508
1509
 
1510
1511
1512
1513
1514
1515
 
1516
1517
1518
1519
1520
 
1521
1522
1523
1524
1525
 
1526
1527
1528
1529
1530
 
1531
1532
1533
1534
1535
1536
1537
 
 
 
 
1538
1539
1540
1541
1542
1543
 
 
 
 
 
 
 
1544
1545
1546
 
1551
1552
1553
1554
 
 
1555
1556
1557
 
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 
398
399
400
401
402
403
404
405
406
407
 
1520
1521
1522
 
1523
1524
1525
1526
1527
1528
 
1529
1530
1531
1532
1533
 
1534
1535
1536
1537
1538
 
1539
1540
1541
1542
1543
 
1544
1545
1546
1547
1548
1549
1550
 
1551
1552
1553
1554
1555
1556
1557
1558
1559
 
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
 
1574
1575
1576
 
1577
1578
1579
1580
1581
@@ -92,6 +92,16 @@
  self.embedded = bool(parent)   self.targetargs = []   + s = QSettings() + for opt in ('subrepos', 'force', 'new-branch', 'noproxy', 'debug'): + val = s.value('sync/' + opt, None).toBool() + if val: + self.opts[opt] = val + for opt in ('remotecmd', 'branch'): + val = str(s.value('sync/' + opt, None).toString()) + if val: + self.opts[opt] = val +   self.repo.configChanged.connect(self.configChanged)     if self.embedded: @@ -388,6 +398,10 @@
  self.opts.update(dlg.outopts)   self.refreshUrl()   + s = QSettings() + for opt, val in self.opts.iteritems(): + s.setValue('sync/' + opt, val) +   def reload(self):   # Refresh configured paths   self.paths = {} @@ -1506,41 +1520,50 @@
  self.setWindowTitle(_('%s - sync options') % parent.repo.displayname)   self.repo = parent.repo   - layout = QFormLayout() + layout = QVBoxLayout()   self.setLayout(layout)     self.newbranchcb = QCheckBox(   _('Allow push of a new branch (--new-branch)'))   self.newbranchcb.setChecked(opts.get('new-branch', False)) - layout.addRow(self.newbranchcb, None) + layout.addWidget(self.newbranchcb)     self.forcecb = QCheckBox(   _('Force push or pull (override safety checks, --force)'))   self.forcecb.setChecked(opts.get('force', False)) - layout.addRow(self.forcecb, None) + layout.addWidget(self.forcecb)     self.subrepocb = QCheckBox(   _('Recurse into subrepositories') + u' (--subrepos)')   self.subrepocb.setChecked(opts.get('subrepos', False)) - layout.addRow(self.subrepocb, None) + layout.addWidget(self.subrepocb)     self.noproxycb = QCheckBox(   _('Temporarily disable configured HTTP proxy'))   self.noproxycb.setChecked(opts.get('noproxy', False)) - layout.addRow(self.noproxycb, None) + layout.addWidget(self.noproxycb)   proxy = self.repo.ui.config('http_proxy', 'host')   self.noproxycb.setEnabled(bool(proxy))     self.debugcb = QCheckBox(   _('Emit debugging output (--debug)'))   self.debugcb.setChecked(opts.get('debug', False)) - layout.addRow(self.debugcb, None) + layout.addWidget(self.debugcb) + + form = QFormLayout() + layout.addLayout(form)     lbl = QLabel(_('Remote command:'))   self.remotele = QLineEdit()   if opts.get('remotecmd'):   self.remotele.setText(hglib.tounicode(opts['remotecmd'])) - layout.addRow(lbl, self.remotele) + form.addRow(lbl, self.remotele) + + lbl = QLabel(_('Branch:')) + self.branchle = QLineEdit() + if opts.get('branch'): + self.branchle.setText(hglib.tounicode(opts['branch'])) + form.addRow(lbl, self.branchle)     BB = QDialogButtonBox   bb = QDialogButtonBox(BB.Ok|BB.Cancel) @@ -1551,7 +1574,8 @@
    def accept(self):   outopts = {} - for name, le in (('remotecmd', self.remotele),): + for name, le in (('remotecmd', self.remotele), + ('branch', self.branchle)):   outopts[name] = hglib.fromunicode(le.text()).strip()     outopts['subrepos'] = self.subrepocb.isChecked()
 
12
13
14
 
15
16
17
 
24
25
26
 
 
27
28
29
 
262
263
264
265
266
 
 
267
268
269
 
282
283
284
285
 
286
287
288
 
535
536
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
539
540
 
601
602
603
 
 
 
 
 
 
 
 
 
604
 
 
 
 
 
 
 
 
 
 
 
 
605
606
607
608
609
610
611
 
650
651
652
 
 
 
 
 
 
 
12
13
14
15
16
17
18
 
25
26
27
28
29
30
31
32
 
265
266
267
 
 
268
269
270
271
272
 
285
286
287
 
288
289
290
291
 
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
 
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
 
 
653
654
655
 
694
695
696
697
698
699
700
701
702
@@ -12,6 +12,7 @@
 import sys  import shutil  import tempfile +import re    from PyQt4.QtCore import *   @@ -24,6 +25,8 @@
 from tortoisehg.util.patchctx import patchctx    _repocache = {} +_kbfregex = re.compile(r'^\.kbf/') +_lfregex = re.compile(r'^\.hglf/')    if 'THGDEBUG' in os.environ:   def dbgoutput(*args): @@ -262,8 +265,8 @@
 def _extendrepo(repo):   class thgrepository(repo.__class__):   - def changectx(self, changeid): - '''Extends Mercurial's standard changectx() method to + def __getitem__(self, changeid): + '''Extends Mercurial's standard __getitem__() method to   a) return a thgchangectx with additional methods   b) return a patchctx if changeid is the name of an MQ   unapplied patch @@ -282,7 +285,7 @@
  os.path.isabs(changeid) and os.path.isfile(changeid):   return genPatchContext(repo, changeid)   - changectx = super(thgrepository, self).changectx(changeid) + changectx = super(thgrepository, self).__getitem__(changeid)   changectx.__class__ = _extendchangectx(changectx)   return changectx   @@ -535,6 +538,28 @@
  dest = tempfile.mktemp(ext+'.bak', root+'_', trashcan)   shutil.copyfile(path, dest)   + def isStandin(self, path): + if 'largefiles' in self.extensions(): + if _lfregex.match(path): + return True + if 'largefiles' in self.extensions() or 'kbfiles' in self.extensions(): + if _kbfregex.match(path): + return True + return False + + def removeStandin(self, path): + if 'largefiles' in self.extensions(): + path = _lfregex.sub('', path) + if 'largefiles' in self.extensions() or 'kbfiles' in self.extensions(): + path = _kbfregex.sub('', path) + return path + + def bfStandin(self, path): + return '.kbf/' + path + + def lfStandin(self, path): + return '.hglf/' + path +   return thgrepository     @@ -601,11 +626,30 @@
  summary += u' \u2026' # ellipsis ...     return summary + + def hasStandin(self, file): + if 'largefiles' in self._repo.extensions(): + if self._repo.lfStandin(file) in self.manifest(): + return True + elif 'largefiles' in self._repo.extensions() or 'kbfiles' in self._repo.extensions(): + if self._repo.bfStandin(file) in self.manifest(): + return True + return False   + def isStandin(self, path): + return self._repo.isStandin(path) + + def removeStandin(self, path): + return self._repo.removeStandin(path) + + def findStandin(self, file): + if 'largefiles' in self._repo.extensions(): + if self._repo.lfStandin(file) in self.manifest(): + return self._repo.lfStandin(file) + return self._repo.bfStandin(file) +   return thgchangectx   - -  _pctxcache = {}  def genPatchContext(repo, patchpath, rev=None):   global _pctxcache @@ -650,3 +694,9 @@
  raise   else:   f.close() + +def isBfStandin(path): + return _kbfregex.match(path) + +def isLfStandin(path): + return _lfregex.match(path)
 
6
7
8
9
10
11
12
 
 
13
14
15
 
52
53
54
 
 
 
 
55
56
57
 
266
267
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
270
271
 
 
 
 
 
 
 
 
 
 
 
 
272
273
274
 
6
7
8
 
9
 
 
10
11
12
13
14
 
51
52
53
54
55
56
57
58
59
60
 
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
@@ -6,10 +6,9 @@
 # GNU General Public License version 2, incorporated herein by reference.    import os -import re   -from mercurial import util, error, merge, commands -from tortoisehg.hgqt import qtlib, htmlui, visdiff +from mercurial import util, error, merge, commands, extensions +from tortoisehg.hgqt import qtlib, htmlui, visdiff, lfprompt  from tortoisehg.util import hglib, shlib  from tortoisehg.hgqt.i18n import _   @@ -52,6 +51,10 @@
  allactions.append(None)   make(_('&Forget'), forget, frozenset('MAC!'), 'filedelete')   make(_('&Add'), add, frozenset('I?'), 'fileadd') + if 'largefiles' in self.repo.extensions(): + make(_('Add &Largefiles...'), addlf, frozenset('I?')) + elif 'kbfiles' in self.repo.extensions(): + make(_('Add &Bfiles'), addlf, frozenset('I?'))   make(_('&Detect Renames...'), guessRename, frozenset('A?!'),   'detect_rename')   make(_('&Ignore...'), ignore, frozenset('?'), 'ignore') @@ -266,9 +269,43 @@
  return True    def add(parent, ui, repo, files): + haslf = 'largefiles' in repo.extensions() + haskbf = 'kbfiles' in repo.extensions() + if haslf or haskbf: + result = lfprompt.promptForLfiles(parent, ui, repo, files, haskbf) + if not result: + return False + files, lfiles = result + for name, module in extensions.extensions(): + if name == 'largefiles': + override_add = module.overrides.override_add + if files: + override_add(commands.add, ui, repo, *files) + if lfiles: + override_add(commands.add, ui, repo, large=True, *lfiles) + return True + if name == 'kbfiles': + override_add = module.bfsetup.override_add + if files: + override_add(commands.add, ui, repo, *files) + if lfiles: + override_add(commands.add, ui, repo, bf=True, *lfiles) + return True   commands.add(ui, repo, *files)   return True   +def addlf(parent, ui, repo, files): + for name, module in extensions.extensions(): + if name == 'largefiles': + override_add = module.overrides.override_add + override_add(commands.add, ui, repo, large=True, *files) + return True + if name == 'kbfiles': + override_add = module.bfsetup.override_add + override_add(commands.add, ui, repo, bf=True, *files) + return True + return False +  def guessRename(parent, ui, repo, files):   from tortoisehg.hgqt.guess import DetectRenameDialog   dlg = DetectRenameDialog(repo, parent, *files)
 
48
49
50
 
51
52
53
 
473
474
475
 
 
 
 
 
 
 
 
 
476
477
478
 
48
49
50
51
52
53
54
 
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
@@ -48,6 +48,7 @@
  rr.setObjectName('RepoRegistryView')   rr.showMessage.connect(self.showMessage)   rr.openRepo.connect(self.openRepo) + rr.removeRepo.connect(self.removeRepo)   rr.hide()   self.addDockWidget(Qt.LeftDockWidgetArea, rr)   self.activeRepoChanged.connect(rr.setActiveTabRepo) @@ -473,6 +474,15 @@
  root = hglib.fromunicode(root)   self._openRepo(root, reuse)   + def removeRepo(self, root): + """ Close tab if the repo is removed from reporegistry [unicode] """ + root = hglib.fromunicode(root) + for i in xrange(self.repoTabsWidget.count()): + w = self.repoTabsWidget.widget(i) + if hglib.tounicode(w.repo.root) == os.path.normpath(root): + self.repoTabCloseRequested(i) + return +   @pyqtSlot(QString)   def openLinkedRepo(self, path):   self.showRepo(path)
 
128
129
130
 
 
 
 
 
131
132
133
 
128
129
130
131
132
133
134
135
136
137
138
@@ -128,6 +128,11 @@
  def thgmqunappliedpatch(self): return True   def thgid(self): return self._identity   + # largefiles/kbfiles methods + def hasStandin(self, file): return False + def isStandin(self, path): return False + def removeStandin(self, path): return path +   def longsummary(self):   summary = hglib.tounicode(self.description())   if self._repo.ui.configbool('tortoisehg', 'longsummary'):
 
32
33
34
35
 
36
37
38
 
57
58
59
 
 
 
 
60
61
62
 
90
91
92
 
 
93
 
 
94
95
96
 
132
133
134
 
135
136
137
 
138
139
140
 
32
33
34
 
35
36
37
38
 
57
58
59
60
61
62
63
64
65
66
 
94
95
96
97
98
99
100
101
102
103
104
 
140
141
142
143
144
145
 
146
147
148
149
@@ -32,7 +32,7 @@
  pass   threading.Thread(target=start_browser).start()   - def shell_notify(paths): + def shell_notify(paths, noassoc=False):   try:   from win32com.shell import shell, shellcon   import pywintypes @@ -57,6 +57,10 @@
  shell.SHChangeNotify(shellcon.SHCNE_UPDATEITEM,   shellcon.SHCNF_IDLIST | shellcon.SHCNF_FLUSH,   pidl, None) + if not noassoc: + shell.SHChangeNotify(shellcon.SHCNE_ASSOCCHANGED, + shellcon.SHCNF_FLUSH, + None, None)     def update_thgstatus(ui, root, wait=False):   '''Rewrite the file .hg/thgstatus @@ -90,7 +94,11 @@
  time.sleep(tdelta)     repo = hg.repository(ui, root) # a fresh repo object is needed + repo.bfstatus = True + repo.lfstatus = True   repostate = repo.status() # will update .hg/dirstate as a side effect + repo.bfstatus = False + repo.lfstatus = False   modified, added, removed, deleted = repostate[:4]     dirstatus = {} @@ -132,9 +140,10 @@
  f.write(s + dn + '\n')   ui.note("%s %s\n" % (s, dn))   f.rename() + return update    else: - def shell_notify(paths): + def shell_notify(paths, noassoc=False):   if not paths:   return   notify = os.environ.get('THG_NOTIFY', '.tortoisehg/notify')