/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 breezy/commit_signature_commands.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-07 22:31:36 UTC
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20181107223136-2uss9siifwvsq2ha
Add WriteGroup contextmanager.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    controldir,
24
24
    errors,
25
25
    gpg,
 
26
    repository as _mod_repository,
26
27
    revision as _mod_revision,
27
28
    )
28
29
from .commands import Command
67
68
        count = 0
68
69
        with repo.lock_write():
69
70
            graph = repo.get_graph()
70
 
            repo.start_write_group()
71
 
            try:
 
71
            with _mod_repository.WriteGroup(repo):
72
72
                for rev_id, parents in graph.iter_ancestry(
73
73
                        [branch.last_revision()]):
74
74
                    if _mod_revision.is_null(rev_id):
87
87
                    count += 1
88
88
                    if not dry_run:
89
89
                        repo.sign_revision(rev_id, gpg_strategy)
90
 
            except:
91
 
                repo.abort_write_group()
92
 
                raise
93
 
            else:
94
 
                repo.commit_write_group()
95
90
        self.outf.write(
96
91
            ngettext('Signed %d revision.\n', 'Signed %d revisions.\n', count) %
97
92
            count)