Mercurial > hg > python
annotate repair.py @ 66:53c37a02d471
working, I think/hope
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Thu, 14 Dec 2023 20:17:48 +0000 |
parents | 5e5feacb730d |
children |
rev | line source |
---|---|
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
1 #!/usr/bin/python3 |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
2 import sys |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
3 |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
4 import lisparser |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
5 |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
6 def readAlist(fn): |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
7 with open(fn,'r') as f: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
8 sline = f.readline() |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
9 alines = (l for l in f if (L:=l).startswith("(")) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
10 return sline, alist(alines), L |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
11 |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
12 # alist fields are: group, rank, read, [marks, [method, [params]]] |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
13 # string int [list] [plist] expr plist |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
14 def alist(lines): |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
15 res = {} |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
16 for l in lines: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
17 ll = lisparser.get_ast(lisparser.normalize_str(l))[0] |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
18 k = ll.pop(0) |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
19 n = int(ll.pop(0)) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
20 res[eval(k)]=[n]+al2p(ll) |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
21 return res |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
22 |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
23 def al2p(ll): |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
24 '''handle read (list or nil), maybe marks (plist or nil), usually method, |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
25 maybe params (plist)''' |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
26 res=[ll.pop(0)] # read |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
27 if ll: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
28 marks = ll.pop(0) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
29 if marks != 'nil': |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
30 marks = dict((e[0],e[1:]) for e in marks) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
31 res.append(marks) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
32 else: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
33 return res |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
34 if ll: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
35 res.append(ll.pop(0)) # method |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
36 else: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
37 return res |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
38 if ll: |
66 | 39 params = ll.pop(0) |
40 if params == 'nil': | |
41 res.append(params) | |
42 else: | |
43 res.append(dict((e[0],e[1:]) for e in params)) # params | |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
44 else: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
45 return res |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
46 if ll: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
47 raise ValueError("too many args: %s"%ll) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
48 return res |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
49 |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
50 def p2l(pl, f): |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
51 if isinstance(pl,list) or isinstance(pl,tuple): |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
52 if len(pl) == 0: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
53 f.write('nil') |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
54 else: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
55 f.write('(') |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
56 space = False |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
57 for e in pl: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
58 if space: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
59 f.write(' ') |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
60 p2l(e,f) |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
61 else: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
62 p2l(e,f) |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
63 space = True |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
64 f.write(')') |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
65 elif isinstance(pl,dict): |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
66 f.write('(') |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
67 space = False |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
68 for k, v in pl.items(): |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
69 if space: |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
70 f.write(' (') |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
71 else: |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
72 f.write('(') |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
73 space = True |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
74 f.write(k) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
75 for e in v: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
76 f.write(' ') |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
77 p2l(e,f) |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
78 f.write(')') |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
79 f.write(')') |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
80 # elif isinstance(pl,str): |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
81 # if pl in ['.','nil']: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
82 # f.write(pl) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
83 # else: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
84 # try: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
85 # int(pl) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
86 # f.write(pl) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
87 # except ValueError: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
88 # f.write(pl) |
60
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
89 else: |
bc1acb1416ab
working on fixing gnus home foulup, see /disk/scratch/{mail,gnus}
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
90 f.write(pl) |
62
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
91 |
66 | 92 def mergeOne(gv,mv): |
93 '''rank: deeper in gnus wins | |
94 read: if unequal | |
95 if mail is nil, use gnus | |
96 otherwise use mail | |
97 marks: merge unseen keys, unequal values for same key prefer gnus | |
98 EXCEPT bogus, w3c-ac-forum, handle by hand DONE | |
99 method: change "ht" to "nnml+ht" | |
100 FIX group-2002-07 in gnus by hand DONE | |
101 params: merge by keys | |
102 ''' | |
103 res = mv.copy() | |
104 if gv[0] > res[0]: # rank | |
105 res[0] = gv[0] | |
106 if res[1] == 'nil': # read | |
107 res[1] = gv[1] | |
108 if res[2] != gv[2]: # marks | |
109 if res[2] == 'nil': | |
110 res[2] = gv[2] | |
111 else: | |
112 for k, v in gv[2].items(): | |
113 # fill in missing, override unequal, if equal no harm done | |
114 res[2][k] = v | |
115 # we prefer m to g for method | |
116 if len(res) == 4: | |
117 # no params | |
118 if len(gv) == 5: | |
119 res.append(gv[4]) | |
120 elif len(gv) == 5: | |
121 if res[4] != gv[4]: | |
122 for k, v in gv[4].items(): | |
123 # fill in missing, override unequal, if equal no harm done | |
124 res[4][k] = v | |
125 return res | |
126 | |
127 def lineout(k,res,outf): | |
128 outf.write('("%s" '%k) | |
129 outf.write(str(res[0])) # rank | |
130 for v in res[1:]: | |
131 outf.write(' ') | |
132 p2l(v,outf) | |
133 outf.write(')\n') | |
134 | |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
135 def merge(gnus, mail, out): |
62
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
136 ''' |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
137 rank, read, marks, method, params |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
138 |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
139 read is everything that is unmarked (nothing in left column) |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
140 marks.seen is everything that has ever been looked it and not DELETED |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
141 marks.tick is a !, marks.forward is F, marks.reply is A. |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
142 ''' # ' |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
143 global g, m |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
144 g1, g, g2 = readAlist(gnus) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
145 _, m, _ = readAlist(mail) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
146 with open(out, "w") as outf: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
147 outf.write(g1) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
148 for k, v in g.items(): |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
149 if k in m: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
150 res = mergeOne(v, m[k]) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
151 else: |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
152 res = v |
66 | 153 lineout(k,res,outf) |
154 for k, v in m.items(): | |
155 if k not in g: | |
156 lineout(k,v,outf) | |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
157 outf.write(g2) |
62
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
158 |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
159 def stale(): |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
160 ''' |
64 | 161 |
62
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
162 Comparison tool: |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
163 |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
164 Watch out for tabs! |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
165 To look for overlap, change 2nd \n in printf to \t |
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
166 |
63 | 167 export T=$'\t' |
64 | 168 export B1="(\(\([^()]\+\|([^)]*)\) \?\)*)" |
169 export P1="\(nil\|$B1\)" | |
170 export P2="\(nil\|\((\($B1 \?\)*)\)\)" | |
171 export MA='\("[^"]*"\|(nndraft "")\)' | |
172 fgrep -hf shared {gnus,mail}/alist.fixed | sed 's/ \([0-9]\) '"$P1 $P2 / \1 \2 \5 /;s/\(.*${T}.*${T}.*${T}\)$MA $P2/\1\2${T}\4/" | |
173 paste <(cat shared) <(fgrep -f shared mail/alist.fixed | sed 's/ \([0-9]\) '"$P $P/ \1 \2 \5 /g" | cut -f 3) <(fgrep -f shared gnus/alist.fixed | sed 's/ \([0-9]\) '"$P $P/ \1 \2 \5 /g" | cut -f 3) | { IFS=' ' ; while read gn g m; do if [ "$g" != "$m" ]; then printf "=----%s------\n%s\n%s\n" "$gn" "$g" "$m"; fi; done ; } | less | |
62
c82a8743fd48
taking notes on how to merge
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
60
diff
changeset
|
174 ''' |
65
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
175 |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
176 if __name__ == '__main__': |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
177 merge(*sys.argv[1:]) |
5e5feacb730d
abandon regexp, work with lisparser output
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
64
diff
changeset
|
178 |