153
150
rev1 = tree.commit('one')
155
152
self.addCleanup(tree.unlock)
156
self.assertUnmerged([], [], tree.branch, tree.branch, 'all')
153
self.assertUnmerged([], [], tree.branch, tree.branch)
154
self.assertUnmerged([], [], tree.branch, tree.branch,
155
local_revid_range=(rev1, rev1))
158
157
def test_one_ahead(self):
159
158
tree = self.make_branch_and_tree('tree')
160
159
rev1 = tree.commit('one')
161
160
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
162
161
rev2 = tree2.commit('two')
163
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch, 'all')
164
self.assertUnmerged([('2', rev2)], [], tree2.branch, tree.branch, 'all')
162
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch)
163
self.assertUnmerged([('2', rev2)], [], tree2.branch, tree.branch)
166
165
def test_restrict(self):
167
166
tree = self.make_branch_and_tree('tree')
168
167
rev1 = tree.commit('one')
169
168
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
170
169
rev2 = tree2.commit('two')
171
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch, 'all')
170
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch)
172
171
self.assertUnmerged([], None, tree.branch, tree2.branch, 'local')
173
172
self.assertUnmerged(None, [('2', rev2)], tree.branch, tree2.branch,
199
202
tree2.merge_from_branch(tree3.branch)
200
203
rev6 = tree2.commit('six', rev_id='rev6')
202
self.assertUnmerged([], [('2', 'rev2', 0), ('3', 'rev3',0 ),
205
self.assertUnmerged([], [('2', 'rev2', 0), ('3', 'rev3', 0),
203
206
('4', 'rev6', 0),
204
207
('3.1.1', 'rev4', 1), ('3.1.2', 'rev5', 1),
206
tree.branch, tree2.branch, 'all',
209
tree.branch, tree2.branch,
207
210
include_merges=True)
209
212
self.assertUnmerged([], [('4', 'rev6', 0),
210
213
('3.1.2', 'rev5', 1), ('3.1.1', 'rev4', 1),
211
('3', 'rev3',0 ), ('2', 'rev2', 0),
214
('3', 'rev3', 0), ('2', 'rev2', 0),
213
tree.branch, tree2.branch, 'all',
216
tree.branch, tree2.branch,
214
217
include_merges=True,
220
self.assertUnmerged([], [('4', 'rev6', 0)],
221
tree.branch, tree2.branch,
222
include_merges=True, remote_revid_range=(rev6, rev6))
224
self.assertUnmerged([], [('3', 'rev3', 0), ('3.1.1', 'rev4', 1)],
225
tree.branch, tree2.branch,
226
include_merges=True, remote_revid_range=(rev3, rev4))
228
self.assertUnmerged([], [('4', 'rev6', 0), ('3.1.2', 'rev5', 1)],
229
tree.branch, tree2.branch,
230
include_merges=True, remote_revid_range=(rev5, rev6))
232
def test_revision_range(self):
233
local = self.make_branch_and_tree('local')
234
lrevid1 = local.commit('one')
235
remote = local.bzrdir.sprout('remote').open_workingtree()
236
rrevid2 = remote.commit('two')
237
rrevid3 = remote.commit('three')
238
rrevid4 = remote.commit('four')
239
lrevid2 = local.commit('two')
240
lrevid3 = local.commit('three')
241
lrevid4 = local.commit('four')
242
local_extra = [('2', lrevid2), ('3', lrevid3), ('4', lrevid4)]
243
remote_extra = [('2', rrevid2), ('3', rrevid3), ('4', rrevid4)]
246
self.assertUnmerged(local_extra, remote_extra,
247
local.branch, remote.branch)
248
self.assertUnmerged(local_extra, remote_extra,
249
local.branch, remote.branch, local_revid_range=(None, None),
250
remote_revid_range=(None, None))
252
# exclude local revisions
253
self.assertUnmerged([('2', lrevid2)], remote_extra,
254
local.branch, remote.branch, local_revid_range=(lrevid2, lrevid2))
255
self.assertUnmerged([('2', lrevid2), ('3', lrevid3)], remote_extra,
256
local.branch, remote.branch, local_revid_range=(lrevid2, lrevid3))
257
self.assertUnmerged([('2', lrevid2), ('3', lrevid3)], None,
258
local.branch, remote.branch, 'local',
259
local_revid_range=(lrevid2, lrevid3))
261
# exclude remote revisions
262
self.assertUnmerged(local_extra, [('2', rrevid2)],
263
local.branch, remote.branch, remote_revid_range=(None, rrevid2))
264
self.assertUnmerged(local_extra, [('2', rrevid2)],
265
local.branch, remote.branch, remote_revid_range=(lrevid1, rrevid2))
266
self.assertUnmerged(local_extra, [('2', rrevid2)],
267
local.branch, remote.branch, remote_revid_range=(rrevid2, rrevid2))
268
self.assertUnmerged(local_extra, [('2', rrevid2), ('3', rrevid3)],
269
local.branch, remote.branch, remote_revid_range=(None, rrevid3))
270
self.assertUnmerged(local_extra, [('2', rrevid2), ('3', rrevid3)],
271
local.branch, remote.branch, remote_revid_range=(rrevid2, rrevid3))
272
self.assertUnmerged(local_extra, [('3', rrevid3)],
273
local.branch, remote.branch, remote_revid_range=(rrevid3, rrevid3))
274
self.assertUnmerged(None, [('2', rrevid2), ('3', rrevid3)],
275
local.branch, remote.branch, 'remote',
276
remote_revid_range=(rrevid2, rrevid3))
278
# exclude local and remote revisions
279
self.assertUnmerged([('3', lrevid3)], [('3', rrevid3)],
280
local.branch, remote.branch, local_revid_range=(lrevid3, lrevid3),
281
remote_revid_range=(rrevid3, rrevid3))