~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to branch_mark.py

  • Committer: Aaron Bentley
  • Date: 2006-04-14 23:13:39 UTC
  • mto: This revision was merged to the branch mainline in revision 363.
  • Revision ID: aaron.bentley@utoronto.ca-20060414231339-c8527e18fbc64436
Fix mark deletion

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        if mark is None:
17
17
            raise BzrError("Please specify a mark to delete")
18
18
        unset_mark(branch, mark)
19
 
    if mark is None:
 
19
    elif mark is None:
20
20
        print_marks(repository)
21
21
    else:
22
22
        set_mark(branch, mark)
67
67
        if mark not in marks:
68
68
            marks[mark] = []
69
69
        marks[mark].append(relative_base(branch))
 
70
        return marks
70
71
    return _set_mark(branch, mark, add)
71
72
 
72
73
def unset_mark(branch, mark):
73
74
    def remove(marks):
74
75
        try:
75
76
            marks[mark].remove(relative_base(branch))
 
77
            return marks
76
78
        except KeyError, ValueError:
77
79
            raise BzrError("Branch does not have this mark set.")
78
80
    return _set_mark(branch, mark, remove)
81
83
    branch.repository.lock_write()
82
84
    try:
83
85
        marks = get_marks(branch.repository)
84
 
        mutate(marks)
 
86
        marks = mutate(marks)
85
87
        set_marks(branch.repository, marks)
86
88
    finally:
87
89
        branch.repository.unlock()