
Euh... Est-ce qu'elle a déjà _vraiment_ fonctionné cette option ??? Même le test dit de "cohérence" est incohérent... - if (date_d > dd and date_d < de) or \ - (date_e > dd and date_e < dd): Index: ChangeLog from Akim Demaille <akim@epita.fr> * prcs2svn/prcs2svn.py (Prcs2svn.test_date_coherency): Well... almost rewrite it. Use understandable variable names. Use readable date formats. Issue readable error messages. Don't run when not required. (DatesSuperposition.mesg): Enhance the informational contents. Index: prcs2svn/prcs2svn.py --- prcs2svn/prcs2svn.py (revision 98) +++ prcs2svn/prcs2svn.py (working copy) @@ -55,9 +55,11 @@ AbstractError.__init__(self, self.mesg) class DatesSuperposition(AbstractError): - mesg = "The dates of your projects must not be superposed (don't use -p)." - def __init__(self): - AbstractError.__init__(self, self.mesg) + mesg = "These projects have overlapping chronologies (don't use -p)." + def __init__(self, p1, d1b, d1e, p2, d2b, d2e): + AbstractError.__init__(self, + "%s\n %s (%s -- %s)\n %s (%s -- %s)" % + (self.mesg, p1, d1b, d1e, p2, d2b, d2e)) class SvnCopyForbidden(AbstractError): mesg = "You must copy the svn repository via file system" @@ -785,6 +787,8 @@ ## Test. def test_date_coherency(self): + if not infos.preserve_dates: + return info("> Test date coherency of projects") dates = [] for project in infos.prcs_projects: @@ -794,23 +798,28 @@ prcs_info = xpopen("prcs info --plain-format -f --sort=date " +\ project + ".prj | sed -ne \"1p;\$p\"" +\ " | sed -e \"s/.*, \(.*\) +[0-9]* by .*/\\1/\"" ) - f_date = "" - l_date = "" + begin = "" + end = "" for f in prcs_info: - if len(f_date) == 0: - f_date = f[:-1] + if begin: + end = f[:-1] else: - l_date = f[:-1] - dates.append((time.mktime(time.strptime(f_date, "%d %b %Y %H:%M:%S")), - time.mktime(time.strptime(l_date, "%d %b %Y %H:%M:%S")), - project)) + begin = f[:-1] prcs_info.close() - for (date_d, date_e, proj) in dates: - for (dd, de, p) in dates: - if p != proj: - if (date_d > dd and date_d < de) or \ - (date_e > dd and date_e < dd): - raise DatesSuperposition() + # DATES will be sorted by date, so leave BEGIN first. + dates.append ((time.strftime ("%F %T", + time.strptime (begin, + "%d %b %Y %H:%M:%S")), + time.strftime ("%F %T", + time.strptime (end, "%d %b %Y %H:%M:%S")), + project)) + # Proj, Begin, End. + for (b1, e1, p1) in dates: + for (b2, e2, p2) in dates: + if p1 != p2: + if not (e2 < b1 or e1 < b2): + raise DatesSuperposition (p1, b1, e1, + p2, b2, e2) dates.sort() infos.prcs_projects = [z for (x,y,z) in dates]
participants (1)
-
Akim Demaille