Changeset 826 in tailor


Ignore:
Timestamp:
09/21/05 00:20:34 (8 years ago)
Author:
lele@…
Hash name:
20050920222034-97f81-d9e12c2087cf2fe809b483d2a03a52c69486e3ef
Message:

Execute the pre and post commit hooks at bootstrap time
This closes #6, allowing the customization of the initial changeset (even
if only when starting from INITIAL).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/target.py

    r822 r826  
    6161    """ 
    6262 
    63     def replayChangeset(self, changeset): 
    64         """ 
    65         Do whatever is needed to replay the changes under the target 
    66         VC, to register the already applied (under the other VC) 
    67         changeset. 
    68         """ 
    69  
    70         changeset = self._adaptChangeset(changeset) 
    71         if changeset is None: 
    72             return 
    73  
    74         try: 
    75             self._replayChangeset(changeset) 
    76         except: 
    77             self.log_error(str(changeset), exc=True) 
    78             raise 
     63    def __getPatchNameAndLog(self, changeset): 
     64        """ 
     65        Return a tuple (patchname, changelog) interpolating changeset's 
     66        information with the template above. 
     67        """ 
    7968 
    8069        if changeset.log == '': 
     
    10089        else: 
    10190            changelog = changeset.log 
     91        return patchname, changelog 
     92 
     93    def replayChangeset(self, changeset): 
     94        """ 
     95        Do whatever is needed to replay the changes under the target 
     96        VC, to register the already applied (under the other VC) 
     97        changeset. 
     98        """ 
     99 
     100        changeset = self._adaptChangeset(changeset) 
     101        if changeset is None: 
     102            return 
     103 
     104        try: 
     105            self._replayChangeset(changeset) 
     106        except: 
     107            self.log_error(str(changeset), exc=True) 
     108            raise 
     109        patchname, log = self.__getPatchNameAndLog(changeset) 
    102110        entries = self._getCommitEntries(changeset) 
    103         self._commit(changeset.date, changeset.author, 
    104                      patchname, changelog, entries) 
     111        self._commit(changeset.date, changeset.author, patchname, log, entries) 
    105112        self._dismissChangeset(changeset) 
    106113 
     
    393400 
    394401        self._initializeWorkingDir() 
     402        # Execute the precommit hooks, but ignore None results 
     403        changeset = self._adaptChangeset(changeset) or changeset 
    395404        revision = changeset.revision 
    396405        source_repository = str(source_repo) 
    397406        if initial: 
    398407            author = changeset.author 
    399             patchname = changeset.log 
    400             log = None 
     408            patchname, log = self.__getPatchNameAndLog(changeset) 
    401409        else: 
    402410            author = "%s@%s" % (AUTHOR, HOST) 
     
    404412            log = BOOTSTRAP_CHANGELOG % locals() 
    405413        self._commit(changeset.date, author, patchname, log) 
     414        self._dismissChangeset(changeset) 
    406415 
    407416    def _initializeWorkingDir(self): 
Note: See TracChangeset for help on using the changeset viewer.