/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: 2019-03-05 07:32:38 UTC
  • mto: (7290.1.21 work)
  • mto: This revision was merged to the branch mainline in revision 7311.
  • Revision ID: jelmer@jelmer.uk-20190305073238-zlqn981opwnqsmzi
Add appveyor configuration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Command that signs unsigned commits by the current user. """
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from . import (
20
22
    controldir,
21
23
    errors,
22
24
    gpg,
23
 
    repository as _mod_repository,
24
25
    revision as _mod_revision,
25
26
    )
26
27
from .commands import Command
27
28
from .option import Option
28
29
from .i18n import gettext, ngettext
 
30
from .sixish import text_type
29
31
 
30
32
 
31
33
class cmd_sign_my_commits(Command):
64
66
        count = 0
65
67
        with repo.lock_write():
66
68
            graph = repo.get_graph()
67
 
            with _mod_repository.WriteGroup(repo):
 
69
            repo.start_write_group()
 
70
            try:
68
71
                for rev_id, parents in graph.iter_ancestry(
69
72
                        [branch.last_revision()]):
70
73
                    if _mod_revision.is_null(rev_id):
83
86
                    count += 1
84
87
                    if not dry_run:
85
88
                        repo.sign_revision(rev_id, gpg_strategy)
 
89
            except BaseException:
 
90
                repo.abort_write_group()
 
91
                raise
 
92
            else:
 
93
                repo.commit_write_group()
86
94
        self.outf.write(
87
95
            ngettext('Signed %d revision.\n', 'Signed %d revisions.\n',
88
96
                     count) % count)
99
107
               help='Comma separated list of GPG key patterns which are'
100
108
               ' acceptable for verification.',
101
109
               short_name='k',
102
 
               type=str,),
 
110
               type=text_type,),
103
111
        'revision',
104
112
        'verbose',
105
113
        ]
134
142
                if to_revid is None:
135
143
                    to_revno = branch.revno()
136
144
                if from_revno is None or to_revno is None:
137
 
                    raise errors.CommandError(
 
145
                    raise errors.BzrCommandError(
138
146
                        gettext('Cannot verify a range of non-revision-history'
139
147
                                ' revisions'))
140
148
                for revno in range(from_revno, to_revno + 1):