~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/sign_my_commits.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        gpg_strategy = bzrlib.gpg.GPGStrategy(config)
59
59
 
60
60
        count = 0
61
 
        # return in partial topological order for the sake of reproducibility
62
 
        for rev_id in repo.all_revision_ids():
63
 
            if repo.has_signature_for_revision_id(rev_id):
64
 
                continue
65
 
            
66
 
            rev = repo.get_revision(rev_id)
67
 
            if rev.committer != committer:
68
 
                continue
 
61
        repo.lock_write()
 
62
        try:
 
63
            # return in partial topological order for the sake of reproducibility
 
64
            for rev_id in repo.all_revision_ids():
 
65
                if repo.has_signature_for_revision_id(rev_id):
 
66
                    continue
 
67
                
 
68
                rev = repo.get_revision(rev_id)
 
69
                if rev.committer != committer:
 
70
                    continue
69
71
 
70
 
            # We have a revision without a signature who has a 
71
 
            # matching committer, start signing
72
 
            print rev_id
73
 
            count += 1
74
 
            if not dry_run:
75
 
                repo.sign_revision(rev_id, gpg_strategy)
 
72
                # We have a revision without a signature who has a 
 
73
                # matching committer, start signing
 
74
                print rev_id
 
75
                count += 1
 
76
                if not dry_run:
 
77
                    repo.sign_revision(rev_id, gpg_strategy)
 
78
        finally:
 
79
            repo.unlock()
76
80
        print 'Signed %d revisions' % (count,)
77
81
 
78
82