Changeset 0b9ac3c in mainline for contrib/bazaar/mbprotect/__init__.py


Ignore:
Timestamp:
2010-02-23T19:03:28Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c62d2e1
Parents:
1ccafee (diff), 5e50394 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/bazaar/mbprotect/__init__.py

    r1ccafee r0b9ac3c  
    3333# branch (a.k.a. linear history) of bzr repositories from unwanted change,
    3434# effectively making the main branch append-only.
    35 # 
     35#
    3636# Specifically we verify that the new main branch contains the old tip.
    3737# This prevents a branch from inadvertently aquiring the tip of another branch.
     
    4646
    4747def pre_change_branch_tip(params):
    48     repo = params.branch.repository
    49 
    50     # Check if the old repository was empty.
    51     if params.old_revid == 'null:':
    52         return
    53 
    54     # First permitted case is appending changesets to main branch.Look for
    55     # old tip in new main branch.
    56     for revision_id in repo.iter_reverse_revision_history(params.new_revid):
    57         if revision_id == params.old_revid:
    58             return      # Found old tip
    59 
    60     # Another permitted case is backing out changesets. Look for new tip
    61     # in old branch.
    62     for revision_id in repo.iter_reverse_revision_history(params.old_revid):
    63         if revision_id == params.new_revid:
    64             return      # Found new tip
    65 
    66     # Trying to do something else. Reject the change.
    67     raise TipChangeRejected('Bad tip. Read http://trac.helenos.org/trac.fcgi/' +
    68         'wiki/BazaarWorkflow')
     48        repo = params.branch.repository
     49       
     50        # Check if the old repository was empty.
     51        if params.old_revid == 'null:':
     52                return
     53       
     54        # First permitted case is appending changesets to main branch.Look for
     55        # old tip in new main branch.
     56        for revision_id in repo.iter_reverse_revision_history(params.new_revid):
     57                if revision_id == params.old_revid:
     58                        return  # Found old tip
     59       
     60        # Another permitted case is backing out changesets. Look for new tip
     61        # in old branch.
     62        for revision_id in repo.iter_reverse_revision_history(params.old_revid):
     63                if revision_id == params.new_revid:
     64                        return  # Found new tip
     65       
     66        # Trying to do something else. Reject the change.
     67        raise TipChangeRejected('Bad tip. Read http://trac.helenos.org/wiki/BazaarWorkflow')
    6968
    7069# Install hook.
    7170bzrlib.branch.Branch.hooks.install_named_hook('pre_change_branch_tip',
    72     pre_change_branch_tip, 'MB-Protect tip check')
     71        pre_change_branch_tip, 'MB-Protect tip check')
Note: See TracChangeset for help on using the changeset viewer.