~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to branchhistory.py

  • Committer: Aaron Bentley
  • Date: 2006-03-18 17:00:37 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20060318170037-6e2b7eeba66a92f7
Lock repo for branch-history

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
    b = Branch.open_containing(branch)[0]
7
7
    descriptor = None
8
8
    start = None
9
 
    for revno, revision in iter_revisiondata(b):
10
 
        new_descriptor = (revision.committer, 
11
 
                          revision.properties.get('branch-nick'))
12
 
        if descriptor is None:
 
9
    b.repository.lock_read()
 
10
    try:
 
11
        for revno, revision in iter_revisiondata(b):
 
12
            new_descriptor = (revision.committer, 
 
13
                              revision.properties.get('branch-nick'))
 
14
            if descriptor is None:
 
15
                descriptor = new_descriptor
 
16
            if start is None:
 
17
                start = revno
 
18
            if branch_change(descriptor, new_descriptor):
 
19
                print_info(descriptor, start, revno - 1)
 
20
                start = revno
13
21
            descriptor = new_descriptor
14
 
        if start is None:
15
 
            start = revno
16
 
        if branch_change(descriptor, new_descriptor):
17
 
            print_info(descriptor, start, revno - 1)
18
 
            start = revno
19
 
        descriptor = new_descriptor
20
 
    print_info(descriptor, start, revno)
 
22
        print_info(descriptor, start, revno)
 
23
    finally:
 
24
        b.repository.unlock()
21
25
 
22
26
def branch_change(old_descriptor, new_descriptor):
23
27
    if old_descriptor == new_descriptor: