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