Lazy commit on <function hostname at 0x7f2b1808bf60>.
This commit is contained in:
parent
0b2f47aabd
commit
ba4084c226
@ -129,6 +129,50 @@ if __name__ == "__main__":
|
|||||||
if sys.argv[1] == "list":
|
if sys.argv[1] == "list":
|
||||||
for k in cfg.keys():
|
for k in cfg.keys():
|
||||||
print(k)
|
print(k)
|
||||||
|
elif sys.argv[1] == "test":
|
||||||
|
dat = dict()
|
||||||
|
cache_file = filepath("test")
|
||||||
|
if is_file_recent(cache_file):
|
||||||
|
with open(cache_file, "rt") as fin:
|
||||||
|
dat = json.load(fin)
|
||||||
|
else:
|
||||||
|
for k in r:
|
||||||
|
path = os.path.expanduser( cfg[k]["path"] )
|
||||||
|
if os.path.exists( path ):
|
||||||
|
cmd = "git -C \"{0}\" status --porcelain=2 --branch".format( path )
|
||||||
|
props = dict()
|
||||||
|
props["key"] = k
|
||||||
|
lines = execute_command(cmd).split("\n")
|
||||||
|
n = 0
|
||||||
|
for line in lines:
|
||||||
|
m = re.match(r"# branch\.(\S+)\s+(.+)$", line)
|
||||||
|
if m:
|
||||||
|
prop = m.group(1)
|
||||||
|
rest = m.group(2)
|
||||||
|
if prop == "ab":
|
||||||
|
print("ding")
|
||||||
|
m2 = re.match(r"[+](\d+)\n[-](\d+)", rest)
|
||||||
|
p2 = "?"
|
||||||
|
if m2:
|
||||||
|
p2 = dict()
|
||||||
|
p2["push"] = int(m2.group(1))
|
||||||
|
p2["pull"] = int(m2.group(2))
|
||||||
|
props[prop] = p2
|
||||||
|
props[prop] = p2
|
||||||
|
elif prop == "oid":
|
||||||
|
props["commit"] = rest
|
||||||
|
else:
|
||||||
|
props[prop] = rest
|
||||||
|
else:
|
||||||
|
n = n + 1
|
||||||
|
props["n"] = n
|
||||||
|
print(props)
|
||||||
|
dat[k] = n
|
||||||
|
with open(cache_file, "wt") as fout:
|
||||||
|
json.dump(dat, fout, indent = 2)
|
||||||
|
for k in dat:
|
||||||
|
status = "-" if dat[k] == 0 else dat[k]
|
||||||
|
print("{0} {1}".format(str(status).rjust(3), k))
|
||||||
elif sys.argv[1] == "status":
|
elif sys.argv[1] == "status":
|
||||||
dat = dict()
|
dat = dict()
|
||||||
cache_file = filepath("status")
|
cache_file = filepath("status")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user