~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-17 16:57:46 UTC
  • mto: (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050917165746-31ec93f725db4a85
Updating to current Branch.open() and RevisionSpec changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
and for applying a changeset.
7
7
"""
8
8
 
 
9
import sys
9
10
from bzrlib.commands import Command, register_command, OPTIONS
 
11
from bzrlib.branch import Branch
 
12
from bzrlib.revisionspec import RevisionSpec
10
13
 
11
14
class cmd_send_changeset(Command):
12
15
    """Send a bundled up changset via mail.
25
28
    takes_args = ['to?']
26
29
 
27
30
    def run(self, to=None, message=None, revision=None, file=None):
28
 
        from bzrlib import find_branch
29
31
        from bzrlib.errors import BzrCommandError
30
32
        from send_changeset import send_changeset
31
33
        
34
36
                raise BzrCommandError('We do not support rollup-changesets yet.')
35
37
            revision = revision[0]
36
38
 
37
 
        b = find_branch('.')
 
39
        b = Branch.open_containing('.')
38
40
 
39
41
        if not to:
40
42
            try:
76
78
    aliases = ['cset']
77
79
 
78
80
    def run(self, base=None, target=None, starting_rev_id=None, verbose=False, revision=None):
79
 
        from bzrlib.branch import find_branch
80
81
        from bzrlib.commands import parse_spec
81
82
        from bzrlib.errors import BzrCommandError
82
83
        from bzrlib import user_encoding
83
84
        import gen_changeset
84
 
        import sys
85
85
        import codecs
86
86
 
87
87
        if revision is not None:
96
96
            else:
97
97
                raise BzrCommandError('--revision can take at most 2 arguments')
98
98
 
99
 
            target_branch = find_branch('.')
100
 
            target_rev_id = target_branch.lookup_revision(target_info)
 
99
            target_branch = Branch.open_containing('.')
 
100
            target_revno, target_rev_id = target_info.in_history(target_branch)
101
101
            base_branch = target_branch
102
102
            if base_info is not None:
103
 
                base_rev_id = target_branch.lookup_revision(base_info)
 
103
                base_revno, base_rev_id = base_info.in_history(target_branch)
104
104
            else:
105
105
                target_rev = target_branch.get_revision(target_rev_id)
106
106
                base_rev_id = target_rev.parents[0].revision_id
108
108
            if target is None:
109
109
                target = './@'
110
110
            b_target_path, target_revno = parse_spec(target)
111
 
            target_branch = find_branch(b_target_path)
 
111
            target_branch = Branch.open_containing(b_target_path)
112
112
            if target_revno is None or target_revno == -1:
113
113
                target_rev_id = target_branch.last_patch()
114
114
            else:
115
 
                target_rev_id = target_branch.lookup_revision(target_revno)
 
115
                target_rev_id = target_branch.get_rev_id(target_revno)
116
116
 
117
117
            if base is None:
118
118
                base_branch = target_branch
120
120
                base_rev_id = target_rev.parents[0].revision_id
121
121
            else:
122
122
                base_path, base_revno = parse_spec(base)
123
 
                base_branch = find_branch(base_path)
 
123
                base_branch = Branch.open_containing(base_path)
124
124
                if base_revno is None or base_revno == -1:
125
125
                    base_rev_id = base_branch.last_patch()
126
126
                else:
127
 
                    base_rev_id = base_branch.lookup_revision(base_revno)
 
127
                    base_rev_id = base_branch.get_rev_id(base_revno)
128
128
 
129
129
        # outf = codecs.getwriter(user_encoding)(sys.stdout,
130
130
        #         errors='replace')
145
145
    takes_args = ['filename?']
146
146
 
147
147
    def run(self, filename=None):
148
 
        import sys
149
148
        from read_changeset import read_changeset
150
 
        from bzrlib.branch import find_branch
151
149
        from bzrlib.xml import pack_xml
152
150
 
153
 
        b = find_branch('.')
 
151
        b = Branch.open_containing('.')
154
152
 
155
153
        if filename is None or filename == '-':
156
154
            f = sys.stdin
173
171
    takes_options = ['reverse', 'auto-commit']
174
172
 
175
173
    def run(self, filename=None, reverse=False, auto_commit=False):
176
 
        from bzrlib.branch import find_branch
177
 
        import sys
178
174
        import apply_changeset
179
175
 
180
 
        b = find_branch('.') # Make sure we are in a branch
 
176
        b = Branch.open_containing('.') # Make sure we are in a branch
181
177
        if filename is None or filename == '-':
182
178
            f = sys.stdin
183
179
        else: