~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to branchhistory.py

  • Committer: Aaron Bentley
  • Date: 2008-10-08 13:55:13 UTC
  • Revision ID: aaron@aaronbentley.com-20081008135513-wjxlb9sgh9ua0edb
Publish getchar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from bzrlib import errors
1
2
from bzrlib.branch import Branch
2
3
from bzrlib.config import extract_email_address
3
4
from bzrtools import short_committer
9
10
    b.repository.lock_read()
10
11
    try:
11
12
        for revno, revision in iter_revisiondata(b):
12
 
            new_descriptor = (revision.committer, 
 
13
            new_descriptor = (revision.committer,
13
14
                              revision.properties.get('branch-nick'))
14
15
            if descriptor is None:
15
16
                descriptor = new_descriptor
24
25
        b.repository.unlock()
25
26
 
26
27
def branch_change(old_descriptor, new_descriptor):
 
28
    try:
 
29
        old_email = extract_email_address(old_descriptor[0])
 
30
    except errors.NoEmailInUsername:
 
31
        old_email = None
 
32
    try:
 
33
        new_email = extract_email_address(new_descriptor[0])
 
34
    except errors.NoEmailInUsername:
 
35
        new_email = None
27
36
    if old_descriptor == new_descriptor:
28
37
        return False
29
38
    elif None not in (old_descriptor[1], new_descriptor[1]) and \
32
41
    elif short_committer(old_descriptor[0]) ==\
33
42
        short_committer(new_descriptor[0]):
34
43
        return False
35
 
    elif old_descriptor[0].strip(' ') == \
36
 
        extract_email_address(new_descriptor[0]):
 
44
    elif old_descriptor[0].strip(' ') == new_email:
37
45
        return False
38
 
    elif new_descriptor[0].strip(' ') == \
39
 
        extract_email_address(old_descriptor[0]):
 
46
    elif new_descriptor[0].strip(' ') == old_email:
40
47
        return False
41
48
    else:
42
49
        return True