Changeset 1199 in tailor


Ignore:
Timestamp:
06/30/06 00:38:26 (7 years ago)
Author:
ydirson@…
Hash name:
20060629223826-130f5-8da750a19a02352e15cb0acb97d222c03666f499
Message:

[git] Improve error cases when importing branches

This patch creates a new exception to identify the case where the user made an error
when specifying a "branchpoint" parameter, and does an explicit check to abort when
attempting to initialize an already-intialized git target repo (most notably hit in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/repository/git.py

    r1198 r1199  
    2121from vcpx.target import SynchronizableTargetWorkingDir, TargetInitializationFailure 
    2222 
     23from vcpx import TailorException 
     24 
     25class BranchpointFailure(TailorException): 
     26    "Specified branchpoint not found in parent branch" 
    2327 
    2428    ## generic stuff 
     
    429433                mkdir(join(self.basedir, self.repository.METADIR)) 
    430434 
    431                 bp = self._tryCommand(['rev-parse', self.repository.BRANCHPOINT])[0] 
     435                bp = self._tryCommand(['rev-parse', self.repository.BRANCHPOINT], 
     436                                      BranchpointFailure)[0] 
    432437                self._tryCommand(['read-tree', bp]) 
    433438                self._tryCommand(['update-ref', self.repository.BRANCHNAME, bp]) 
     
    435440 
    436441            else: 
     442                if exists(join(self.basedir, self.repository.storagedir)): 
     443                    raise TargetInitializationFailure( 
     444                        "Repository %s already exists - " 
     445                        "did you forget to set \"branch\" parameter ?" % self.repository.storagedir) 
     446 
    437447                self._tryCommand(['init-db']) 
    438448                if self.repository.repository: 
Note: See TracChangeset for help on using the changeset viewer.