Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

hggtk: introduce thgstatus.py

as a replacement for hgext/thgstatus.py

Changeset 72d63376523f

Parent d24e8e6ab636

by Adrian Buehlmann

Changes to 4 files · Browse files at 72d63376523f Showing diff from parent d24e8e6ab636 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​hgtk.py Stacked
 
233
234
235
236
237
238
 
 
 
239
240
241
 
613
614
615
616
 
 
 
 
 
 
 
617
618
619
 
233
234
235
 
 
 
236
237
238
239
240
241
 
613
614
615
 
616
617
618
619
620
621
622
623
624
625
@@ -233,9 +233,9 @@
  shlib.shell_notify([os.getcwd()])    def thgstatus(ui, *pats, **opts): - """update thgstatus""" - shlib.update_thgstatus(ui, paths.find_root()) - shlib.shell_notify([os.getcwd()]) + """update TortoiseHg status cache""" + from hggtk.thgstatus import run + run(ui, *pats, **opts)    def clone(ui, *pats, **opts):   """clone tool""" @@ -613,7 +613,13 @@
  (serve,   [('', 'webdir-conf', '', _('name of the webdir config file'))],   _('hgtk serve [OPTION]...')), - "thgstatus": (thgstatus, [], _('hgtk thgstatus')), + "thgstatus": (thgstatus, + [('', 'delay', None, _('wait until the second ticks over')), + ('n', 'notify', [], _('notify the shell for path(s) given')), + ('', 'remove', None, _('remove the status cache')), + ('s', 'show', None, _('show the contents of the' + ' status cache (no update)'))], + _('hgtk thgstatus [OPTION]')),   "^update|checkout|co": (update,   [('r', 'rev', '', _('revision to update'))],   ('hgtk update')),
Change 1 of 1 Show Entire File hggtk/​thgstatus.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
@@ -0,0 +1,47 @@
+# +# thgstatus.py - update TortoiseHg status cache +# +# Copyright (C) 2009 Adrian Buehlmann +# + +'''update TortoiseHg status cache''' + +from mercurial import hg +from thgutil import shlib +import os + +def cachefilepath(repo): + return repo.join("thgstatus") + +def dirname(f): + return f[:max(0, f.rfind("/"))] + +def run(_ui, *pats, **opts): + path = '.' + if opts.get('repository'): + path = opts.get('repository') + repo = hg.repository(_ui, path) + + if opts.get('remove'): + try: + os.remove(cachefilepath(repo)) + except OSError: + pass + return + + if opts.get('show'): + try: + f = open(cachefilepath(repo), 'rb') + for e in f: + _ui.status("%s %s\n" % (e[0], e[1:-1])) + f.close() + except IOError: + _ui.status("*no status*\n") + return + + wait = opts.get('delay') is not None + shlib.update_thgstatus(_ui, path, wait=wait) + + if opts.get('notify'): + shlib.shell_notify(opts.get('notify')) + _ui.note("thgstatus updated\n")
Change 1 of 1 Show Entire File thgutil/​shlib.py Stacked
 
94
95
96
97
 
 
 
98
99
100
 
94
95
96
 
97
98
99
100
101
102
@@ -94,7 +94,9 @@
  dirstatus[dirname(fn)] = 'r'   f = open(repo.join("thgstatus"), 'wb')   for dn in sorted(dirstatus): - f.write(dirstatus[dn] + dn + '\n') + s = dirstatus[dn] + f.write(s + dn + '\n') + ui.note("%s %s\n" % (s, dn))   f.close()    else:
 
481
482
483
 
484
485
486
 
481
482
483
484
485
486
487
@@ -481,6 +481,7 @@
  std::string hgroot = GetHgRepoRoot(cwd);   if (!hgroot.empty())   Dirstatecache::invalidate(hgroot); + hgcmd += " --notify .";   }     LaunchCommand(hgcmd, cwd);