David Bremner <da...@tethera.net> writes: > +EXPECTED=$NOTMUCH_SRCDIR/test/git-remote.expected-output > +MAKE_EXPORT_PY=$NOTMUCH_SRCDIR/test/make-export.py
I see I lost the script make-export.py going from v1 to v2. I will re-roll the series to include it, but I want try a refactor that puts the URL parsing into the library in a new notmuch_database_open_url function that can be re-used by e.g. neomutt (hopefully).
# generate a test input for the 'export' subcommand of the # git-remote-notmuch helper from notmuch2 import Database from time import time from hashlib import sha1 def hexencode(str): output_charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-_@=.," out = "" for char in str: if not char in output_charset: out+= f"%{ord(char):x}" else: out+= char return out db = Database(config=Database.CONFIG.SEARCH) count=1 print("export") mark={} for msg in db.messages(""): mark[msg.messageid]=count blob="" for tag in msg.tags: blob += f"{tag}\n" print (f"blob\nmark :{count}"); print (f"data {len(blob)}\n{blob}") count=count+1 print (f"\ncommit refs/heads/master\nmark :{count+1}") ctime = int(time()) print (f"author Notmuch Test Suite <notm...@example.com> {ctime} +0000") print (f"committer Notmuch Test Suite <notm...@example.com> {ctime} +0000") print (f"data 8\nignored") for msg in db.messages(""): digest = sha1(msg.messageid.encode('utf8')).hexdigest() filename = hexencode(msg.messageid) print (f"M 100644 :{mark[msg.messageid]} digest[0:2]}/{digest[2:4]}/{filename}/tags") print("\ndone\n")
_______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org