Mercurial > hg > gcmultimerge
comparison multimerge.py @ 51:54644b29a9a3
Match also summaryOverride attribute against the source calendar regexp.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Jul 2016 18:51:25 +0300 |
parents | f8618bae162a |
children | b87dbc887f63 |
comparison
equal
deleted
inserted
replaced
50:f8618bae162a | 51:54644b29a9a3 |
---|---|
362 | 362 |
363 ## Filter desired SOURCE calendars based on specified regexp | 363 ## Filter desired SOURCE calendars based on specified regexp |
364 src_re = re.compile(cfg.source_regex, re.UNICODE) | 364 src_re = re.compile(cfg.source_regex, re.UNICODE) |
365 src_calendars = [] | 365 src_calendars = [] |
366 for calendar in calendars: | 366 for calendar in calendars: |
367 if "summary" in calendar: | 367 if u"summary" in calendar: |
368 # Find destination calendar ID if not set | 368 # Find destination calendar ID if not set |
369 if not cfg.dest_id and cfg.dest_name == calendar["summary"].strip(): | 369 if not cfg.dest_id and cfg.dest_name == calendar["summary"].strip(): |
370 cfg.mset("dest_id", calendar["id"]) | 370 cfg.mset("dest_id", calendar["id"]) |
371 | 371 |
372 # If summary or summaryOverride match the regexp, add calendar | |
372 mre = src_re.match(calendar["summary"]) | 373 mre = src_re.match(calendar["summary"]) |
373 if mre: | 374 if mre: |
374 calendar["gcm_title"] = mre.group(cfg.source_regmap[0]) | 375 calendar["gcm_title"] = mre.group(cfg.source_regmap[0]) |
375 calendar["gcm_id"] = mre.group(cfg.source_regmap[1]) | 376 calendar["gcm_id"] = mre.group(cfg.source_regmap[1]) |
376 src_calendars.append(calendar) | 377 src_calendars.append(calendar) |
378 elif u"summaryOverride" in calendar: | |
379 mre = src_re.match(calendar[u"summaryOverride"]) | |
380 if mre: | |
381 calendar["gcm_title"] = mre.group(cfg.source_regmap[0]) | |
382 calendar["gcm_id"] = mre.group(cfg.source_regmap[1]) | |
383 src_calendars.append(calendar) | |
377 | 384 |
378 gcm_debug(u"{0} source calendars found.".format(len(src_calendars))) | 385 gcm_debug(u"{0} source calendars found.".format(len(src_calendars))) |
379 | 386 |
380 | 387 |
381 ## Check if we have destination calendar ID | 388 ## Check if we have destination calendar ID |