Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

merge with stable

Changeset ca98dcc20b29

Parents 7a6fc5821d9c

Parents f4b2cdbcdde5

by Steve Borho

Changes to 12 files · Browse files at ca98dcc20b29 Showing diff from parent 7a6fc5821d9c f4b2cdbcdde5 Diff from another changeset...

 
569
570
571
572
 
573
574
575
576
577
 
 
578
579
580
 
569
570
571
 
572
573
 
 
 
 
574
575
576
577
578
@@ -569,12 +569,10 @@
  self.glog_parent.custombutton.set_active(True)   self.glog_parent.reload_log(**opts)   else: - # Else launch our own GLog instance + # Else launch our own glog instance   from hggtk import history - dialog = history.GLog(self.ui, self.repo, self.cwd, - [self.repo.root], {}) - dialog.open_with_file(self.curfile) - dialog.display() + dlg = history.run(self.ui, filehist=self.curfile) + dlg.display()     def revert_file(self, menuitem):   'User selected file revert from the file list context menu'
Change 1 of 1 Show Entire File hggtk/​datamine.py Stacked
 
151
152
153
154
155
 
156
157
158
 
151
152
153
 
 
154
155
156
157
@@ -151,8 +151,7 @@
    def cmenu_file_log(self, menuitem):   from hggtk import history - dlg = history.GLog(self.ui, self.repo, self.cwd, [self.repo.root], {}) - dlg.open_with_file(self.curpath) + dlg = history.run(self.ui, filehist=self.curpath)   dlg.display()     def grep_button_release(self, widget, event):
Change 1 of 2 Show Entire File hggtk/​gdialog.py Stacked
 
16
17
18
19
20
21
22
 
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
 
16
17
18
 
19
20
21
 
405
406
407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
409
410
411
412
413
414
415
416
417
418
419
420
@@ -16,7 +16,6 @@
 import atexit    from mercurial import cmdutil, util, ui, hg, commands -from hgext import extdiff    from thgutil.i18n import _  from thgutil import settings, hglib, paths @@ -406,43 +405,16 @@
    return True, textout   - def _do_diff(self, patterns, options, modal=False): - from hggtk import visdiff, thgconfig - if self.ui.configbool('tortoisehg', 'vdiffnowin'): - tools = visdiff.readtools(self.ui) - preferred = self.ui.config('tortoisehg', 'vdiff', 'vdiff') - if not preferred or preferred not in tools: - Prompt(_('No visual diff configured'), - _('Please select a visual diff application.'), self).run() - dlg = thgconfig.ConfigDialog(self.repo.root, False) - dlg.show_all() - dlg.focus_field('tortoisehg.vdiff') - dlg.run() - dlg.hide() - self.ui = ui.ui() - self._parse_config() - return - - file = len(patterns) == 1 and patterns[0] or '' - diffcmd, diffopts = tools[preferred] - opts = {'change': options.get('change')} - if not opts['change']: - opts['rev'] = options.get('rev') - - def dodiff(): - extdiff.dodiff(self.ui, self.repo, diffcmd, diffopts, - [self.repo.wjoin(file)], opts) - - thread = threading.Thread(target=dodiff, name='diff:' + file) - thread.setDaemon(True) - thread.start() - - else: - dialog = visdiff.FileSelectionDialog(patterns, options) - dialog.show_all() - if modal: - dialog.run() - dialog.hide() + def _do_diff(self, canonpats, options, modal=False): + from hggtk import visdiff + options['canonpats'] = canonpats + dialog = visdiff.run(self.ui, **options) + if not dialog: + return + dialog.show_all() + if modal: + dialog.run() + dialog.hide()     def _diff_file(self, stat, file):   self._do_diff(file and [file] or [], self.opts)
Change 1 of 3 Show Entire File hggtk/​hgtk.py Stacked
 
251
252
253
 
 
254
255
256
 
402
403
404
405
 
 
 
 
406
407
408
 
662
663
664
665
 
 
666
667
668
 
251
252
253
254
255
256
257
258
 
404
405
406
 
407
408
409
410
411
412
413
 
667
668
669
 
670
671
672
673
674
@@ -251,6 +251,8 @@
 def gtkrun(dlgfunc, ui, *args, **opts):   portable_fork(ui, opts)   win = dlgfunc(ui, *args, **opts) + if not win: + return   global mainwindow, gtkmainalive   mainwindow = win   if hasattr(win, 'display'): @@ -402,7 +404,10 @@
   def vdiff(ui, *pats, **opts):   """launch configured visual diff tool""" - from hggtk.visdiff import run + from hggtk.visdiff import run, rawextdiff + if opts.get('raw'): + rawextdiff(ui, *pats, **opts) + return   gtkrun(run, ui, *pats, **opts)    ### help management, adapted from mercurial.commands.help_() @@ -662,7 +667,8 @@
  ('hgtk update')),   "^vdiff": (vdiff,   [('c', 'change', '', _('changeset to view in diff tool')), - ('r', 'rev', [], _('revisions to view in diff tool'))], + ('r', 'rev', [], _('revisions to view in diff tool')), + ('', 'raw', None, _('directly use raw extdiff command'))],   _('launch visual diff tool')),   "^version": (version,   [('v', 'verbose', None, _('print license'))],
Change 1 of 3 Show Entire File hggtk/​history.py Stacked
 
221
222
223
224
225
226
227
228
229
230
 
233
234
235
236
 
237
238
239
240
241
242
 
243
244
245
 
960
961
962
963
964
965
966
 
967
968
 
 
969
 
970
971
 
221
222
223
 
 
 
 
224
225
226
 
229
230
231
 
232
233
234
235
236
237
 
238
239
240
241
 
956
957
958
 
959
960
 
961
962
 
963
964
965
966
967
968
@@ -221,10 +221,6 @@
  menu.show_all()   return menu   - def open_with_file(self, file): - 'Call this before display() to open with file history' - self.opts['filehist'] = file -   def prepare_display(self):   'Called at end of display() method'   self.ready = True @@ -233,13 +229,13 @@
  os.chdir(self.repo.root) # for paths relative to repo root     self.graphview.set_property('original-tip-revision', self.origtip) - if 'orig-tip' in self.opts: + if self.opts.get('orig-tip') is not None:   origtip = self.opts['orig-tip']   if origtip != len(self.repo):   self.origtip = origtip   self.graphview.set_property('original-tip-revision', origtip)   self.newbutton.set_active(True) - elif 'filehist' in self.opts: + elif self.opts.get('filehist') is not None:   self.custombutton.set_active(True)   self.reload_log(pats = [self.opts['filehist']])   elif 'revrange' in self.opts: @@ -960,12 +956,13 @@
  return True    def run(ui, *pats, **opts): - limit = opts.get('limit')   cmdoptions = {   'follow':False, 'follow-first':False, 'copies':False, 'keyword':[], - 'limit':limit, 'rev':[], 'removed':False, 'no_merges':False, + 'limit':0, 'rev':[], 'removed':False, 'no_merges':False,   'date':None, 'only_merges':None, 'prune':[], 'git':False, - 'verbose':False, 'include':[], 'exclude':[] + 'verbose':False, 'include':[], 'exclude':[], 'from-synch':False, + 'orig-tip':None, 'filehist':None   } + cmdoptions.update(opts)   pats = hglib.canonpaths(pats)   return GLog(ui, None, None, pats, cmdoptions)
 
148
149
150
151
 
152
153
154
 
148
149
150
 
151
152
153
154
@@ -148,7 +148,7 @@
  self.grapher = None   return   - if 'filehist' in opts: + if opts.get('filehist') is not None:   self.grapher = filelog_grapher(self.repo, opts['filehist'])   elif graphcol:   end = 0
Change 1 of 3 Show Entire File hggtk/​status.py Stacked
 
774
775
776
 
777
778
779
780
781
782
 
783
784
785
 
834
835
836
837
 
 
838
839
840
 
847
848
849
850
 
851
852
853
 
774
775
776
777
778
779
780
781
782
 
783
784
785
786
 
835
836
837
 
838
839
840
841
842
 
849
850
851
 
852
853
854
855
@@ -774,12 +774,13 @@
  if not paths:   return   wfile = self.filemodel[paths[0]][FM_PATH] + pfile = util.pconvert(wfile)   difftext = []   if self.merging:   difftext = [_('===== Diff to first parent =====\n')]   wctx = self.repo[None]   pctxs = wctx.parents() - matcher = cmdutil.matchfiles(self.repo, [wfile]) + matcher = cmdutil.matchfiles(self.repo, [pfile])   for s in patch.diff(self.repo, pctxs[0].node(), None,   match=matcher, opts=patch.diffopts(self.ui, self.opts)):   difftext.extend(s.splitlines(True)) @@ -834,7 +835,8 @@
  difftext = cStringIO.StringIO()   ctx = self.repo[self._node1]   try: - fctx = ctx.filectx(wfile) + pfile = util.pconvert(wfile) + fctx = ctx.filectx(pfile)   except hglib.LookupError:   fctx = None   if fctx and fctx.size() > hglib.getmaxdiffsize(self.ui): @@ -847,7 +849,7 @@
  difftext.writelines(lines)   difftext.seek(0)   else: - matcher = cmdutil.matchfiles(self.repo, [wfile]) + matcher = cmdutil.matchfiles(self.repo, [pfile])   diffopts = mdiff.diffopts(git=True, nodates=True)   for s in patch.diff(self.repo, self._node1, self._node2,   match=matcher, opts=diffopts):
Change 1 of 1 Show Entire File hggtk/​synch.py Stacked
 
340
341
342
343
 
344
345
346
 
340
341
342
 
343
344
345
346
@@ -340,7 +340,7 @@
    def _view_pulled_changes(self, button):   opts = {'orig-tip' : self.origchangecount, 'from-synch' : True} - dlg = history.GLog(self.ui, None, None, [], opts) + dlg = history.run(self.ui, **opts)   dlg.display()     def _update_to_tip(self, button):
Change 1 of 1 Show Entire File hggtk/​visdiff.py Stacked
 
273
274
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@@ -273,5 +273,58 @@
  tools[cmd] = [path, diffopts]   return tools   +def rawextdiff(ui, *pats, **opts): + 'launch raw extdiff command, block until finish' + from hgext import extdiff + try: + repo = hg.repository(ui, path=paths.find_root()) + except hglib.RepoError: + # hgtk should catch this earlier + ui.warn(_('No repository found here') + '\n') + return + tools = readtools(ui) + preferred = ui.config('tortoisehg', 'vdiff', 'vdiff') + try: + diffcmd, diffopts = tools[preferred] + except KeyError: + ui.warn(_('Extdiff command not recognized\n')) + return + pats = hglib.canonpaths(pats) + ret = extdiff.dodiff(ui, repo, diffcmd, diffopts, pats, opts) + if ret == 0: + gdialog.Prompt(_('No file changes'), + _('There are no file changes to view'), None).run() +  def run(ui, *pats, **opts): - return FileSelectionDialog(hglib.canonpaths(pats), opts) + if ui.configbool('tortoisehg', 'vdiffnowin'): + import sys + # Spawn background process and exit + if hasattr(sys, "frozen"): + args = [sys.argv[0]] + else: + args = [sys.executable] + [sys.argv[0]] + args.extend(['vdiff', '--nofork', '--raw']) + revs = opts.get('rev', []) + change = opts.get('change') + if change: + args.extend(['--change', str(change)]) + if len(revs) == 1: + args.extend(['--change', str(revs[0])]) + else: + for r in revs: + args.extend(['--rev', str(r)]) + args.extend(pats) + args.extend(opts.get('canonpats', [])) + if os.name == 'nt': + args = ['"%s"' % arg for arg in args] + oldcwd = os.getcwd() + root = paths.find_root() + os.chdir(root) + os.spawnv(os.P_NOWAIT, sys.executable, args) + os.chdir(oldcwd) + return None + else: + pats = hglib.canonpaths(pats) + if opts.get('canonpats'): + pats = list(pats) + opts['canonpats'] + return FileSelectionDialog(pats, opts)
 
31
32
33
34
 
35
 
 
36
37
38
 
92
93
94
 
 
95
96
97
 
108
109
110
111
 
112
113
114
115
 
 
116
117
118
 
 
 
 
 
 
 
 
 
 
119
 
120
121
122
 
129
130
131
132
 
 
 
 
 
 
 
 
 
133
134
135
 
31
32
33
 
34
35
36
37
38
39
40
 
94
95
96
97
98
99
100
101
 
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
 
145
146
147
 
148
149
150
151
152
153
154
155
156
157
158
159
@@ -31,8 +31,10 @@
     Dirstate* Dirstatecache::get( - const std::string& hgroot, const std::string& cwd) + const std::string& hgroot, const std::string& cwd, bool& unset)  { + unset = false; +   typedef std::list<E>::iterator Iter;     Iter iter = cache().begin(); @@ -92,6 +94,8 @@
    if (iter->dstate)   { + unset = iter->unset; +   if (!new_stat)   return iter->dstate;   @@ -108,15 +112,27 @@
  TDEBUG_TRACE("Dirstatecache::get: reading " << hgroot);   }   - bool unset = false; + unset = false;   unsigned tc0 = GetTickCount();   std::auto_ptr<Dirstate> ds = Dirstate::read(path, unset);   unsigned tc1 = GetTickCount();   + bool request_thgstatus_update = true; +   if (unset)   { - TDEBUG_TRACE("Dirstatecache::get: has unset entries"); + if (iter->unset) + { + TDEBUG_TRACE( + "Dirstatecache::get: **** old and new have unset entries"); + request_thgstatus_update = false; + } + else + { + TDEBUG_TRACE("Dirstatecache::get: new has unset entries"); + }   } +   iter->unset = unset;     delete iter->dstate; @@ -129,7 +145,15 @@
  iter->dstate_mtime = stat.mtime;   iter->dstate_size = stat.size;   - Thgstatus::update(cwd); + if (request_thgstatus_update) + { + TDEBUG_TRACE("Dirstatecache::get: calling Thgstatus::update"); + Thgstatus::update(cwd); + } + else + { + TDEBUG_TRACE("Dirstatecache::get: omitting Thgstatus::update"); + }     return iter->dstate;  }
 
47
48
49
50
 
 
51
52
53
 
47
48
49
 
50
51
52
53
54
@@ -47,7 +47,8 @@
  static std::list<E>& cache();    public: - static Dirstate* get(const std::string& hgroot, const std::string& cwd); + static Dirstate* get( + const std::string& hgroot, const std::string& cwd, bool& unset);   static void invalidate(const std::string& hgroot);  };  
 
182
183
184
 
 
185
186
187
188
189
 
190
191
192
 
198
199
200
201
 
202
203
204
 
245
246
247
248
 
 
 
 
 
 
 
 
 
 
 
249
250
251
 
182
183
184
185
186
187
188
189
190
 
191
192
193
194
 
200
201
202
 
203
204
205
206
 
247
248
249
 
250
251
252
253
254
255
256
257
258
259
260
261
262
263
@@ -182,11 +182,13 @@
  return 0;   }   + bool unset = false; +   if (cur.isdir)   {   if (!relpath.empty())   { - Dirstate* pds2 = Dirstatecache::get(cur.hgroot, cur.basedir); + Dirstate* pds2 = Dirstatecache::get(cur.hgroot, cur.basedir, unset);   if (pds2 && !pds2->root().getdir(relpath))   {   last = cur; @@ -198,7 +200,7 @@
  }   else   { - Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir); + Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset);   if (!pds)   {   TDEBUG_TRACE("HgQueryDirstate: Dirstatecache::get(" @@ -245,7 +247,17 @@
    if (basedir_status != 'M')   { - Thgstatus::update(cur.hgroot); + if (unset) + { + TDEBUG_TRACE( + "HgQueryDirstate: omitting Thgstatus::update"); + } + else + { + TDEBUG_TRACE( + "HgQueryDirstate: calling Thgstatus::update"); + Thgstatus::update(cur.hgroot); + }   }   }   }