mercurial/changelog.py
changeset 6762 f67d1468ac50
parent 6750 fb42030d79d6
child 7040 f29b674cc221
equal deleted inserted replaced
6761:cb981fc955fb 6762:f67d1468ac50
   128                 extra[k] = v
   128                 extra[k] = v
   129         return extra
   129         return extra
   130 
   130 
   131     def encode_extra(self, d):
   131     def encode_extra(self, d):
   132         # keys must be sorted to produce a deterministic changelog entry
   132         # keys must be sorted to produce a deterministic changelog entry
   133         keys = d.keys()
   133         items = [_string_escape('%s:%s' % (k, d[k])) for k in util.sort(d)]
   134         keys.sort()
       
   135         items = [_string_escape('%s:%s' % (k, d[k])) for k in keys]
       
   136         return "\0".join(items)
   134         return "\0".join(items)
   137 
   135 
   138     def read(self, node):
   136     def read(self, node):
   139         """
   137         """
   140         format used:
   138         format used:
   173         if not extra.get('branch'):
   171         if not extra.get('branch'):
   174             extra['branch'] = 'default'
   172             extra['branch'] = 'default'
   175         files = l[3:]
   173         files = l[3:]
   176         return (manifest, user, (time, timezone), files, desc, extra)
   174         return (manifest, user, (time, timezone), files, desc, extra)
   177 
   175 
   178     def add(self, manifest, list, desc, transaction, p1=None, p2=None,
   176     def add(self, manifest, files, desc, transaction, p1=None, p2=None,
   179                   user=None, date=None, extra={}):
   177                   user=None, date=None, extra={}):
   180 
   178 
   181         user, desc = util.fromlocal(user), util.fromlocal(desc)
   179         user, desc = util.fromlocal(user), util.fromlocal(desc)
   182 
   180 
   183         if date:
   181         if date:
   187         if extra and extra.get("branch") in ("default", ""):
   185         if extra and extra.get("branch") in ("default", ""):
   188             del extra["branch"]
   186             del extra["branch"]
   189         if extra:
   187         if extra:
   190             extra = self.encode_extra(extra)
   188             extra = self.encode_extra(extra)
   191             parseddate = "%s %s" % (parseddate, extra)
   189             parseddate = "%s %s" % (parseddate, extra)
   192         list.sort()
   190         l = [hex(manifest), user, parseddate] + util.sort(files) + ["", desc]
   193         l = [hex(manifest), user, parseddate] + list + ["", desc]
       
   194         text = "\n".join(l)
   191         text = "\n".join(l)
   195         return self.addrevision(text, transaction, len(self), p1, p2)
   192         return self.addrevision(text, transaction, len(self), p1, p2)