mercurial/changelog.py
changeset 7035 9d023ef7b467
parent 6259 d60aa0308b02
child 7040 f29b674cc221
equal deleted inserted replaced
7026:3e49127bcec3 7035:9d023ef7b467
     4 #
     4 #
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 from node import bin, hex, nullid
     8 from node import bin, hex, nullid
     9 from revlog import revlog
     9 from revlog import revlog, RevlogError
       
    10 from i18n import _
    10 import util
    11 import util
    11 
    12 
    12 def _string_escape(text):
    13 def _string_escape(text):
    13     """
    14     """
    14     >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)}
    15     >>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)}
   176         return (manifest, user, (time, timezone), files, desc, extra)
   177         return (manifest, user, (time, timezone), files, desc, extra)
   177 
   178 
   178     def add(self, manifest, list, desc, transaction, p1=None, p2=None,
   179     def add(self, manifest, list, desc, transaction, p1=None, p2=None,
   179                   user=None, date=None, extra={}):
   180                   user=None, date=None, extra={}):
   180 
   181 
       
   182         user = user.strip()
       
   183         if "\n" in user:
       
   184             raise RevlogError(_("username %s contains a newline") % `user`)
   181         user, desc = util.fromlocal(user), util.fromlocal(desc)
   185         user, desc = util.fromlocal(user), util.fromlocal(desc)
   182 
   186 
   183         if date:
   187         if date:
   184             parseddate = "%d %d" % util.parsedate(date)
   188             parseddate = "%d %d" % util.parsedate(date)
   185         else:
   189         else: