Changeset 786 in tailor for vcpx/git.py


Ignore:
Timestamp:
09/06/05 19:44:39 (8 years ago)
Author:
Todd Mokros <tmokros@…>
Hash name:
20050906174439-4e4b6-2ae409ae098e6f3b9213a05c1b66df09ee22996c
Message:

Update git backend to handle empty changesets

git-core doesn't support commits that don't change any files,
so just skip them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/git.py

    r785 r786  
    1212__docformat__ = 'reStructuredText' 
    1313 
    14 from shwrap import ExternalCommand, ReopenableNamedTemporaryFile 
     14from shwrap import ExternalCommand, ReopenableNamedTemporaryFile, PIPE 
    1515from target import SyncronizableTargetWorkingDir, TargetInitializationFailure 
    1616from source import ChangesetApplicationFailure 
     
    8686        c = ExternalCommand(cwd=self.basedir, command=cmd) 
    8787 
    88         c.execute(env=env, input='\n'.join(logmessage)) 
     88        (out, _) = c.execute(stdout=PIPE, env=env, input='\n'.join(logmessage)) 
    8989        if c.exit_status: 
    90             raise ChangesetApplicationFailure("%s returned status %d" % 
    91                                               (str(c), c.exit_status)) 
     90            if out is None or out.readline().strip() != 'nothing to commit': 
     91                raise ChangesetApplicationFailure("%s returned status %d" % 
     92                                                  (str(c), c.exit_status)) 
     93            else: 
     94                # empty changeset, which git-core doesn't support 
     95                pass 
    9296 
    9397    def _removePathnames(self, names): 
Note: See TracChangeset for help on using the changeset viewer.