# HG changeset patch # User Franz Glasner # Date 1538832100 -7200 # Node ID d6ce48feffd54d771a4f27fa9499a76ec8468110 # Parent f4f13a25fe3ed015bc881c3be1768e28bb76aae5 Discard leading whitespace (' ', '\t') from fields. But escape with '@' them if needed. diff -r f4f13a25fe3e -r d6ce48feffd5 extensions/timestamps.py --- a/extensions/timestamps.py Sat Oct 06 14:58:42 2018 +0200 +++ b/extensions/timestamps.py Sat Oct 06 15:21:40 2018 +0200 @@ -30,6 +30,8 @@ If fields contain a ``,`` or ``#`` or ``@``: put them into ``@``; eventually duplicate ``@`` characters within. + Leading white space is discarded from fields. If needed use ``@``. + (This is very roughly simalar to a Perforce checkpoint -- but with comma as fiel separator instead of a space.) @@ -289,8 +291,11 @@ :return: an escaped version or the original one """ + if fn.startswith(' ') or fn.startswith('\t') \ + or fn.endswith(' ') or fn.endswith('\t'): + return "@%s@" % fn.replace('@', "@@") if "," in fn or '@' in fn or '#' in fn: - return "@%s@" % fn.replace("@", "@@") + return "@%s@" % fn.replace('@', "@@") else: return fn @@ -372,6 +377,9 @@ c2 = db.read(1) comment.append(c2) field = comment + elif c in " \t": + if field: + field.append(c) else: field.append(c) c = db.read(1)