~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_send.py

  • Committer: Aaron Bentley
  • Date: 2007-07-30 13:49:09 UTC
  • mfrom: (2654.3.1 bzr-send)
  • mto: This revision was merged to the branch mainline in revision 2663.
  • Revision ID: abentley@panoramicfeedback.com-20070730134909-awx1pvti168z1xr3
Merge submit -> send rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        """Parent location is used as a basis by default"""
46
46
        self.make_trees()
47
47
        os.chdir('grandparent')
48
 
        errmsg = self.run_bzr('submit', retcode=3)[1]
 
48
        errmsg = self.run_bzr('send -o-', retcode=3)[1]
49
49
        self.assertContainsRe(errmsg, 'No submit branch known or specified')
50
50
        os.chdir('../branch')
51
 
        stdout, stderr = self.run_bzr('submit')
 
51
        stdout, stderr = self.run_bzr('send -o-')
52
52
        self.assertEqual(stderr.count('Using saved location'), 1)
53
53
        br = read_bundle(StringIO(stdout))
54
54
        self.assertRevisions(br, ['revision3'])
61
61
        """Submit location can be used and set"""
62
62
        self.make_trees()
63
63
        os.chdir('branch')
64
 
        br = read_bundle(StringIO(self.run_bzr('submit')[0]))
 
64
        br = read_bundle(StringIO(self.run_bzr('send -o-')[0]))
65
65
        self.assertRevisions(br, ['revision3'])
66
 
        br = read_bundle(StringIO(self.run_bzr('submit ../grandparent')[0]))
 
66
        br = read_bundle(StringIO(self.run_bzr('send ../grandparent -o-')[0]))
67
67
        self.assertRevisions(br, ['revision3', 'revision2'])
68
68
        # submit location should be auto-remembered
69
 
        br = read_bundle(StringIO(self.run_bzr('submit')[0]))
70
 
        self.assertRevisions(br, ['revision3', 'revision2'])
71
 
        self.run_bzr('submit ../parent')
72
 
        br = read_bundle(StringIO(self.run_bzr('bundle')[0]))
73
 
        self.assertRevisions(br, ['revision3', 'revision2'])
74
 
        self.run_bzr('submit ../parent --remember')
75
 
        br = read_bundle(StringIO(self.run_bzr('bundle')[0]))
 
69
        br = read_bundle(StringIO(self.run_bzr('send -o-')[0]))
 
70
        self.assertRevisions(br, ['revision3', 'revision2'])
 
71
        self.run_bzr('send ../parent -o-')
 
72
        br = read_bundle(StringIO(self.run_bzr('send -o-')[0]))
 
73
        self.assertRevisions(br, ['revision3', 'revision2'])
 
74
        self.run_bzr('send ../parent --remember -o-')
 
75
        br = read_bundle(StringIO(self.run_bzr('send -o-')[0]))
76
76
        self.assertRevisions(br, ['revision3'])
77
 
        err = self.run_bzr('submit --remember', retcode=3)[1]
 
77
        err = self.run_bzr('send --remember -o-', retcode=3)[1]
78
78
        self.assertContainsRe(err, 
79
79
                              '--remember requires a branch to be specified.')
80
80
 
81
81
    def test_revision_branch_interaction(self):
82
82
        self.make_trees()
83
83
        os.chdir('branch')
84
 
        bi = read_bundle(StringIO(self.run_bzr('bundle ../grandparent')[0]))
 
84
        bi = read_bundle(StringIO(self.run_bzr('send ../grandparent -o-')[0]))
85
85
        self.assertRevisions(bi, ['revision3', 'revision2'])
86
 
        out = StringIO(self.run_bzr('submit ../grandparent -r -2')[0])
 
86
        out = StringIO(self.run_bzr('send ../grandparent -r -2 -o-')[0])
87
87
        bi = read_bundle(out)
88
88
        self.assertRevisions(bi, ['revision2'])
89
 
        sio = StringIO(self.run_bzr('submit -r -2..-1')[0])
 
89
        sio = StringIO(self.run_bzr('send -r -2..-1 -o-')[0])
90
90
        md = merge_directive.MergeDirective.from_lines(sio.readlines())
91
91
        self.assertEqual('revision2', md.base_revision_id)
92
92
        self.assertEqual('revision3', md.revision_id)
93
93
        sio.seek(0)
94
94
        bi = read_bundle(sio)
95
95
        self.assertRevisions(bi, ['revision2', 'revision3'])
96
 
        self.run_bzr('submit ../grandparent -r -2..-1')
 
96
        self.run_bzr('send ../grandparent -r -2..-1 -o-')
97
97
 
98
98
    def test_output(self):
99
99
        # check output for consistency
101
101
        # which would break patch-based bundles
102
102
        self.make_trees()        
103
103
        os.chdir('branch')
104
 
        stdout = self.run_bzr_subprocess('submit')[0]
 
104
        stdout = self.run_bzr_subprocess('send -o-')[0]
105
105
        br = read_bundle(StringIO(stdout))
106
106
        self.assertRevisions(br, ['revision3'])
107
107
 
111
111
        bar = self.make_branch_and_tree('bar')
112
112
        bar.commit('rev b')
113
113
        os.chdir('foo')
114
 
        self.run_bzr('submit ../bar')
 
114
        self.run_bzr('send ../bar -o-')
115
115
 
116
 
    def submit_directive(self, args):
117
 
        sio = StringIO(self.run_bzr(['submit'] + args)[0])
 
116
    def send_directive(self, args):
 
117
        sio = StringIO(self.run_bzr(['send', '-o-'] + args)[0])
118
118
        return merge_directive.MergeDirective.from_lines(sio.readlines())
119
119
 
120
120
    def test_content_options(self):
121
121
        """--no-patch and --no-bundle should work and be independant"""
122
122
        self.make_trees()
123
123
        os.chdir('branch')
124
 
        md = self.submit_directive([])
 
124
        md = self.send_directive([])
125
125
        self.assertIsNot(None, md.bundle)
126
126
        self.assertIsNot(None, md.patch)
127
 
        md = self.submit_directive(['--no-patch'])
 
127
        md = self.send_directive(['--no-patch'])
128
128
        self.assertIsNot(None, md.bundle)
129
129
        self.assertIs(None, md.patch)
130
 
        md = self.submit_directive(['--no-bundle', '.', '.'])
 
130
        md = self.send_directive(['--no-bundle', '.', '.'])
131
131
        self.assertIs(None, md.bundle)
132
132
        self.assertIsNot(None, md.patch)
133
 
        md = self.submit_directive(['--no-bundle', '--no-patch', '.', '.'])
 
133
        md = self.send_directive(['--no-bundle', '--no-patch', '.', '.'])
134
134
        self.assertIs(None, md.bundle)
135
135
        self.assertIs(None, md.patch)
136
136
 
137
137
    def test_from_option(self):
138
138
        self.make_trees()
139
 
        self.run_bzr('submit', retcode=3)
140
 
        md = self.submit_directive(['--from', 'branch'])
 
139
        self.run_bzr('send', retcode=3)
 
140
        md = self.send_directive(['--from', 'branch'])
141
141
        self.assertEqual('revision3', md.revision_id)
142
 
        md = self.submit_directive(['-f', 'branch'])
 
142
        md = self.send_directive(['-f', 'branch'])
143
143
        self.assertEqual('revision3', md.revision_id)
144
144
 
145
145
    def test_output_option(self):
146
146
        self.make_trees()
147
 
        stdout = self.run_bzr('submit -f branch --output file1')[0]
 
147
        stdout = self.run_bzr('send -f branch --output file1')[0]
148
148
        self.assertEqual('', stdout)
149
149
        md_file = open('file1', 'rb')
150
150
        self.addCleanup(md_file.close)
151
151
        self.assertContainsRe(md_file.read(), 'revision3')
 
152
        stdout = self.run_bzr('send -f branch --output -')[0]
 
153
        self.assertContainsRe(stdout, 'revision3')
152
154
 
 
155
    def test_output_option_required(self):
 
156
        self.make_trees()
 
157
        self.run_bzr_error(('File must be specified with --output',),
 
158
                           'send -f branch')