Changeset 72d63376523f…
Parent d24e8e6ab636…
by
Changes to 4 files · Browse files at 72d63376523f Showing diff from parent d24e8e6ab636 Diff from another changeset...
@@ -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')),
|
|
@@ -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")
|
@@ -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,6 +481,7 @@ std::string hgroot = GetHgRepoRoot(cwd);
if (!hgroot.empty())
Dirstatecache::invalidate(hgroot);
+ hgcmd += " --notify .";
}
LaunchCommand(hgcmd, cwd);
|
Loading...