mercurial/changelog.py
changeset 43142 beed7ce61681
parent 43077 687b865b95ad
child 43143 037a8759eda1
equal deleted inserted replaced
43141:52781d57313d 43142:beed7ce61681
    24 )
    24 )
    25 from .utils import (
    25 from .utils import (
    26     dateutil,
    26     dateutil,
    27     stringutil,
    27     stringutil,
    28 )
    28 )
       
    29 
       
    30 from .revlogutils import sidedata as sidedatamod
    29 
    31 
    30 _defaultextra = {b'branch': b'default'}
    32 _defaultextra = {b'branch': b'default'}
    31 
    33 
    32 
    34 
    33 def _string_escape(text):
    35 def _string_escape(text):
   674             elif branch in (b".", b"null", b"tip"):
   676             elif branch in (b".", b"null", b"tip"):
   675                 raise error.StorageError(
   677                 raise error.StorageError(
   676                     _(b'the name \'%s\' is reserved') % branch
   678                     _(b'the name \'%s\' is reserved') % branch
   677                 )
   679                 )
   678         sortedfiles = sorted(files)
   680         sortedfiles = sorted(files)
       
   681         sidedata = None
   679         if extra is not None:
   682         if extra is not None:
   680             for name in (
   683             for name in (
   681                 b'p1copies',
   684                 b'p1copies',
   682                 b'p2copies',
   685                 b'p2copies',
   683                 b'filesadded',
   686                 b'filesadded',
   702                 extra[b'p2copies'] = p2copies
   705                 extra[b'p2copies'] = p2copies
   703             if filesadded is not None:
   706             if filesadded is not None:
   704                 extra[b'filesadded'] = filesadded
   707                 extra[b'filesadded'] = filesadded
   705             if filesremoved is not None:
   708             if filesremoved is not None:
   706                 extra[b'filesremoved'] = filesremoved
   709                 extra[b'filesremoved'] = filesremoved
       
   710         elif self._copiesstorage == b'changeset-sidedata':
       
   711             sidedata = {}
       
   712             if p1copies is not None:
       
   713                 sidedata[sidedatamod.SD_P1COPIES] = p1copies
       
   714             if p2copies is not None:
       
   715                 sidedata[sidedatamod.SD_P2COPIES] = p2copies
       
   716             if filesadded is not None:
       
   717                 sidedata[sidedatamod.SD_FILESADDED] = filesadded
       
   718             if filesremoved is not None:
       
   719                 sidedata[sidedatamod.SD_FILESREMOVED] = filesremoved
   707 
   720 
   708         if extra:
   721         if extra:
   709             extra = encodeextra(extra)
   722             extra = encodeextra(extra)
   710             parseddate = b"%s %s" % (parseddate, extra)
   723             parseddate = b"%s %s" % (parseddate, extra)
   711         l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc]
   724         l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc]
   712         text = b"\n".join(l)
   725         text = b"\n".join(l)
   713         return self.addrevision(text, transaction, len(self), p1, p2)
   726         return self.addrevision(
       
   727             text, transaction, len(self), p1, p2, sidedata=sidedata
       
   728         )
   714 
   729 
   715     def branchinfo(self, rev):
   730     def branchinfo(self, rev):
   716         """return the branch name and open/close state of a revision
   731         """return the branch name and open/close state of a revision
   717 
   732 
   718         This function exists because creating a changectx object
   733         This function exists because creating a changectx object