commit eb508eeaebd97b31275d17bf244a3f9bd5a2ae06
parent a94f4c8fd0221410a7ebab65222b8fdd1e2cc2a9
Author: William Casarin <jb55@jb55.com>
Date: Mon, 21 Jun 2021 13:58:53 -0700
updates
Diffstat:
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/bitcoin-contacts.xsh b/bitcoin-contacts.xsh
@@ -1,23 +1,37 @@
#!/usr/bin/env xonsh
import sys
+import os
-$GIT_DIR = "/home/jb55/dev/github/bitcoin/bitcoin/.git"
+dir = $(git rev-parse --show-toplevel).strip()
+name = $(git config user.name).strip()
+email = $(git config user.email).strip()
+user = f"{name} <{email}>"
+fresh_file = os.path.join(dir, "contacts_fresh_hashes")
+tmp_file = os.path.join(dir, "contacts_new_hashes")
+contacts_tsv = os.path.join(dir, "contacts.tsv")
+touch @(contacts_tsv)
+
+sys.stderr.write(f"finding new patches for {user}\n")
+
+def get_hashes():
+ cut -d "\t" --output-delimiter="\t" -f1 @(contacts_tsv) > @(tmp_file)
git fetch
-git log --no-merges --all --date=local --format=%H | head -n1000 | sort > fresh_hashes
+git log --no-merges --all --format=%H | head -n1050 | sort > @(fresh_file)
-new_hashes = $(grep -Fxvf hashes fresh_hashes).split("\n")
+get_hashes()
+new_hashes = $(grep -Fxvf @(tmp_file) @(fresh_file)).split("\n")
-with open("contacts.tsv", "a") as contacts:
+with open(contacts_tsv, "a") as contacts:
for hash in new_hashes:
emails = $(git-contacts @(hash)^-).split("\n")
emails = filter(lambda e: e != "", emails)
for email in emails:
+ if email == user:
+ sys.stderr.write(f"emailing {hash}^- to '{user}'\n")
+ git-send-email --suppress-cc=all --to=@(email) @(hash)^-
line = "{}\t{}\n".format(hash, email)
contacts.write(line)
- sys.stdout.write(line)
-cat fresh_hashes hashes | sort -u > new_hashes
-mv new_hashes hashes
-rm fresh_hashes
+rm -f @(fresh_file) @(tmp_file)