Refine this sketch and add a way to call it. Not finished though!
Chris Pressey
1 year, 1 month ago
124 | 124 | |
125 | 125 | |
126 | 126 | def verify(router, options): |
127 | skipuntil = None | |
128 | 127 | active = False |
129 | if skipuntil: | |
130 | print("Skipping until", skipuntil) | |
128 | if options.skip_until: | |
129 | print("Skipping until", options.skip_until) | |
131 | 130 | else: |
132 | 131 | active = True |
133 | 132 | |
141 | 140 | |
142 | 141 | with open(manifest, "r") as f: |
143 | 142 | for line in f: |
144 | # if [ "$F" = "$SKIPUNTIL" ]; then | |
145 | # ACTIVE=Y | |
146 | # fi | |
147 | # if [ ! -d "$F" ]; then | |
148 | # if [ $ACTIVE != "Y" ]; then | |
149 | # echo -n "" | |
150 | # echo "(skipping $F)" | |
151 | # elif diff --brief --new-file "$F" "$TARGET$F"; then | |
152 | # echo "$F" | |
153 | # else | |
154 | # echo "!!! $F" | |
155 | # fi | |
156 | # fi | |
157 | pass | |
143 | path = line.strip() | |
144 | if path == options.skip_until: | |
145 | active = True | |
146 | if not os.path.isdir(path): | |
147 | if not active: | |
148 | print("skipping ", path) | |
149 | else: | |
150 | # execute diff --brief --new-file "$F" "$TARGET$F" | |
151 | diffs = False | |
152 | if diffs: | |
153 | print("!!!", path) | |
154 | else: | |
155 | print(path) | |
158 | 156 | |
159 | 157 | |
160 | 158 | # - - - - driver - - - - |
192 | 190 | help='Reverse the direction of the sync operation' |
193 | 191 | ) |
194 | 192 | parser_sync.set_defaults(func=sync) |
193 | ||
194 | # - - - - verify - - - - | |
195 | parser_verify = subparsers.add_parser('verify', help='Verify contents on both sides of a sync stream match') | |
196 | parser_verify.add_argument('stream_name', metavar='STREAM', type=str, | |
197 | help='Name of stream (or stream:subdirectory) to verify across' | |
198 | ) | |
199 | parser_verify.add_argument('--skip-until', default=None, type=str, | |
200 | help='If given, do not start verification until (i.e. continue verification at) this filename' | |
201 | ) | |
202 | parser_verify.set_defaults(func=verify) | |
195 | 203 | |
196 | 204 | # - - - - rename - - - - |
197 | 205 | parser_rename = subparsers.add_parser( |