blob 3837dc3aa433ba7f535e017842186909244db2e8 1227 bytes (raw)
name: test/make-export.py # note: path name is non-authoritative(*)
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
| | # 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 <notmuch@example.com> {ctime} +0000")
print (f"committer Notmuch Test Suite <notmuch@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")
|
debug log:
solving 3837dc3a ...
found 3837dc3a in https://yhetil.org/notmuch/20240828160710.866567-5-david@tethera.net/
applying [1/1] https://yhetil.org/notmuch/20240828160710.866567-5-david@tethera.net/
diff --git a/test/make-export.py b/test/make-export.py
new file mode 100644
index 00000000..3837dc3a
Checking patch test/make-export.py...
Applied patch test/make-export.py cleanly.
index at:
100644 3837dc3aa433ba7f535e017842186909244db2e8 test/make-export.py
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).