mercurial/context.py
changeset 19665 cb0c94ef1ebe
parent 19664 61dcb2aa7378
child 19666 09459edfb48b
equal deleted inserted replaced
19664:61dcb2aa7378 19665:cb0c94ef1ebe
   824 class commitablectx(basectx):
   824 class commitablectx(basectx):
   825     """A commitablectx object provides common functionality for a context that
   825     """A commitablectx object provides common functionality for a context that
   826     wants the ability to commit, e.g. workingctx or memctx."""
   826     wants the ability to commit, e.g. workingctx or memctx."""
   827     def __init__(self, repo, text="", user=None, date=None, extra=None,
   827     def __init__(self, repo, text="", user=None, date=None, extra=None,
   828                  changes=None):
   828                  changes=None):
   829         pass
       
   830 
       
   831 class workingctx(commitablectx):
       
   832     """A workingctx object makes access to data related to
       
   833     the current working directory convenient.
       
   834     date - any valid date string or (unixtime, offset), or None.
       
   835     user - username string, or None.
       
   836     extra - a dictionary of extra values, or None.
       
   837     changes - a list of file lists as returned by localrepo.status()
       
   838                or None to use the repository status.
       
   839     """
       
   840     def __init__(self, repo, text="", user=None, date=None, extra=None,
       
   841                  changes=None):
       
   842         self._repo = repo
   829         self._repo = repo
   843         self._rev = None
   830         self._rev = None
   844         self._node = None
   831         self._node = None
   845         self._text = text
   832         self._text = text
   846         if date:
   833         if date:
   866             except UnicodeDecodeError:
   853             except UnicodeDecodeError:
   867                 raise util.Abort(_('branch name not in UTF-8!'))
   854                 raise util.Abort(_('branch name not in UTF-8!'))
   868             self._extra['branch'] = branch
   855             self._extra['branch'] = branch
   869         if self._extra['branch'] == '':
   856         if self._extra['branch'] == '':
   870             self._extra['branch'] = 'default'
   857             self._extra['branch'] = 'default'
       
   858 
       
   859 class workingctx(commitablectx):
       
   860     """A workingctx object makes access to data related to
       
   861     the current working directory convenient.
       
   862     date - any valid date string or (unixtime, offset), or None.
       
   863     user - username string, or None.
       
   864     extra - a dictionary of extra values, or None.
       
   865     changes - a list of file lists as returned by localrepo.status()
       
   866                or None to use the repository status.
       
   867     """
       
   868     def __init__(self, repo, text="", user=None, date=None, extra=None,
       
   869                  changes=None):
       
   870         super(workingctx, self).__init__(repo, text, user, date, extra, changes)
   871 
   871 
   872     def __str__(self):
   872     def __str__(self):
   873         return str(self._parents[0]) + "+"
   873         return str(self._parents[0]) + "+"
   874 
   874 
   875     def __nonzero__(self):
   875     def __nonzero__(self):