/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Michael Ellerman
  • Date: 2005-10-19 05:37:33 UTC
  • mto: (1185.16.126)
  • mto: This revision was merged to the branch mainline in revision 1488.
  • Revision ID: michael@ellerman.id.au-20051019053733-fdbf18701d7ab8ea
Strict commit was a little .. ah .. too strict, oops :}

branch.unknowns() returns a generator, so we can't do if branch.unknowns(),
it's always True.

if len(list(branch.unknowns())) might look cleanest, but creating the list of
unknowns is not cheap for large numbers of unknown files.

Instead we use a for loop to raise an exception as soon as we get one unknown
back from the generator.

Add more tests to make sure this doesn't break again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        self.allow_pointless = allow_pointless
207
207
        self.revprops = revprops
208
208
 
209
 
        if strict and branch.unknowns():
210
 
            raise StrictCommitFailed()
 
209
        if strict:
 
210
            # raise an exception as soon as we find a single unknown.
 
211
            for unknown in branch.unknowns():
 
212
                raise StrictCommitFailed()
211
213
 
212
214
        if timestamp is None:
213
215
            self.timestamp = time.time()