~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2005-10-24 08:37:32 UTC
  • Revision ID: robertc@robertcollins.net-20051024083732-7f99eeec70f2bbb8
BUGFIX: re-sign should accept ranges

Show diffs side-by-side

added added

removed removed

Lines of Context:
1569
1569
        if revision_id is not None:
1570
1570
            b.sign_revision(revision_id, gpg_strategy)
1571
1571
        elif revision is not None:
1572
 
            for rev in revision:
1573
 
                if rev is None:
1574
 
                    raise BzrCommandError('You cannot specify a NULL revision.')
1575
 
                revno, rev_id = rev.in_history(b)
 
1572
            if len(revision) == 1:
 
1573
                revno, rev_id = revision[0].in_history(b)
1576
1574
                b.sign_revision(rev_id, gpg_strategy)
 
1575
            elif len(revision) == 2:
 
1576
                # are they both on rh- if so we can walk between them
 
1577
                # might be nice to have a range helper for arbitrary
 
1578
                # revision paths. hmm.
 
1579
                from_revno, from_revid = revision[0].in_history(b)
 
1580
                to_revno, to_revid = revision[1].in_history(b)
 
1581
                if to_revid is None:
 
1582
                    to_revno = b.revno()
 
1583
                if from_revno is None or to_revno is None:
 
1584
                    raise BzrCommandError('Cannot sign a range of non-revision-history revisions')
 
1585
                for revno in range(from_revno, to_revno + 1):
 
1586
                    b.sign_revision(b.get_rev_id(revno), gpg_strategy)
 
1587
            else:
 
1588
                raise BzrCommandError('Please supply either one revision, or a range.')
1577
1589
 
1578
1590
 
1579
1591
# these get imported and then picked up by the scan for cmd_*