diff -r 43d560970666 sage-combinat
a
|
b
|
|
67 | 67 | metavar="http://sage.math.washington.edu:2144", |
68 | 68 | default="http://sage.math.washington.edu:2144", type="string") |
69 | 69 | |
| 70 | parser.add_option("-n", dest="n", action="store_true", |
| 71 | help="After qselect: disable all previous non version guards") |
| 72 | |
70 | 73 | (options, args) = parser.parse_args() |
71 | 74 | |
72 | 75 | ############################################################################## |
… |
… |
|
184 | 187 | info("Use option --force to proceed anyway") |
185 | 188 | exit(1) |
186 | 189 | |
187 | | def qselect_backward_compatibility_patches(): |
188 | | global sage_version |
| 190 | def qselect_backward_compatibility_patches(guards): |
| 191 | global sage_version, options |
189 | 192 | r""" |
190 | 193 | Selects the appropriate guards for this version of sage |
191 | 194 | e.g. if we are running sage 3.0.2, then we want to apply all |
… |
… |
|
194 | 197 | |
195 | 198 | # FIXME: how to change the guards on a one by one basis |
196 | 199 | |
197 | | active_non_version_guards = filter(lambda guard: re.match("^(sage_)?(\d+_)*(\d+)$", guard) is None, hg_active_guards()) |
198 | | info("Active guards: %s"%" ".join(active_non_version_guards)) |
| 200 | non_version_guards = filter(lambda guard: re.match("^(sage_)?(\d+_)*(\d+)$", guard) is None, hg_active_guards()) |
| 201 | info("Current non version guards: %s"%" ".join(non_version_guards)) |
199 | 202 | |
| 203 | if options.n: |
| 204 | non_version_guards = [] |
| 205 | |
| 206 | non_version_guards = non_version_guards + guards |
| 207 | |
| 208 | info("Updated non version guards: %s"%" ".join(non_version_guards)) |
| 209 | |
200 | 210 | sage_version_as_list = [int(s) for s in re.split("\.", sage_version)] |
201 | 211 | def is_newversion_guard(guard): |
202 | 212 | """ |
… |
… |
|
213 | 223 | info("Skip backward compatibility patches for sage "+re.sub("_",".",guard)) |
214 | 224 | return False |
215 | 225 | |
216 | | newversion_guards = map(lambda guard: guard[1:], # get rid of leading "+" |
| 226 | version_guards = map(lambda guard: guard[1:], # get rid of leading "+" |
217 | 227 | filter(is_newversion_guard, hg_all_guards())) |
218 | 228 | |
219 | 229 | info("Updating guards") |
220 | 230 | system(hg+" qselect -q -n") |
221 | 231 | system(hg+" qselect "+ |
222 | | " ".join(active_non_version_guards + |
223 | | newversion_guards)) |
| 232 | " ".join(non_version_guards + version_guards)) |
224 | 233 | |
225 | 234 | def update(update_from_sage_main = False): |
226 | 235 | r""" |
… |
… |
|
346 | 355 | info(hg_qstatus()) |
347 | 356 | |
348 | 357 | elif args[0] == "qselect": |
349 | | qselect_backward_compatibility_patches() |
| 358 | qselect_backward_compatibility_patches(args[1:]) |
350 | 359 | |
351 | 360 | else: |
352 | 361 | error("unknown command "+args[0]) |