Mercurial > hg > cc > cirrus_work
comparison bin/merge_date.py @ 109:52c6a9b0fc8c
loosen must-match criterion in the both-messy case
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Tue, 19 Sep 2023 19:29:41 +0100 |
parents | 40c460fed99f |
children | 4a52585a1aac |
comparison
equal
deleted
inserted
replaced
108:9f7a35bf07f9 | 109:52c6a9b0fc8c |
---|---|
109 if DEBUG>1: | 109 if DEBUG>1: |
110 sys.stderr.write("xl: %s\n"%(' '.join(xp.decode('ascii') | 110 sys.stderr.write("xl: %s\n"%(' '.join(xp.decode('ascii') |
111 for xp in (xkey, xdate, xurl)))) | 111 for xp in (xkey, xdate, xurl)))) |
112 messyU, xkey1, xkey2 = keys(xkey) | 112 messyU, xkey1, xkey2 = keys(xkey) |
113 if messyD: | 113 if messyD: |
114 noMatch = (ddate != xdate or | 114 noMatch = (not dkey.startswith(xkey1) or |
115 not dkey.startswith(xkey1) or | 115 (xkey2 is not None and dkey!=xkey2)) |
116 (xkey2 is not None and dkey!=xkey2) or | |
117 durl!=xurl) | |
118 if messyU: | 116 if messyU: |
119 # better match | 117 # better match |
120 if noMatch: | 118 if noMatch: |
121 raise ValueError("Fail1: md: %s mu: %s\n" | 119 raise ValueError("Fail1: md: %s mu: %s\n" |
122 " xkey: %s\n" | 120 " xkey: %s\n" |
161 raise ValueError("Fail2: md: %s mu: %s\n" | 159 raise ValueError("Fail2: md: %s mu: %s\n" |
162 " xkey: %s\n" | 160 " xkey: %s\n" |
163 " dkey: %s\n" | 161 " dkey: %s\n" |
164 " xdate: %s\n" | 162 " xdate: %s\n" |
165 " ddate: %s\n" | 163 " ddate: %s\n" |
164 " xurl: %s\n" | |
165 " durl: %s\n" | |
166 "dfq: %s\n" | 166 "dfq: %s\n" |
167 "k1, k2: |%s|%s|\n" | 167 "k1, k2: |%s|%s|\n" |
168 "FN: %s XCNT: %s DCNT: %s\n" | 168 "FN: %s XCNT: %s DCNT: %s\n" |
169 "xl: %s"%(messyD, messyU, xkey, dkey, xdate, ddate, | 169 "xl: %s"%(messyD, messyU, xkey, dkey, xdate, ddate, |
170 xurl, durl, | |
170 (b'\n '.join(dfq)).decode('ascii'), | 171 (b'\n '.join(dfq)).decode('ascii'), |
171 xkey1, xkey2, FN, XCNT, DCNT, xl)) | 172 xkey1, xkey2, FN, XCNT, DCNT, xl)) |
172 NF.write(xl) | 173 NF.write(xl) |
173 if DEBUG>1: | 174 if DEBUG>1: |
174 sys.stderr.write("out_nl\n") | 175 sys.stderr.write("out_nl\n") |