154
153
rev1 = tree.commit('one')
156
155
self.addCleanup(tree.unlock)
157
self.assertUnmerged([], [], tree.branch, tree.branch)
158
self.assertUnmerged([], [], tree.branch, tree.branch,
159
local_revid_range=(rev1, rev1))
156
self.assertUnmerged([], [], tree.branch, tree.branch, 'all')
161
158
def test_one_ahead(self):
162
159
tree = self.make_branch_and_tree('tree')
163
160
rev1 = tree.commit('one')
164
161
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
165
162
rev2 = tree2.commit('two')
166
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch)
167
self.assertUnmerged([('2', rev2)], [], tree2.branch, tree.branch)
163
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch, 'all')
164
self.assertUnmerged([('2', rev2)], [], tree2.branch, tree.branch, 'all')
169
166
def test_restrict(self):
170
167
tree = self.make_branch_and_tree('tree')
171
168
rev1 = tree.commit('one')
172
169
tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
173
170
rev2 = tree2.commit('two')
174
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch)
171
self.assertUnmerged([], [('2', rev2)], tree.branch, tree2.branch, 'all')
175
172
self.assertUnmerged([], None, tree.branch, tree2.branch, 'local')
176
173
self.assertUnmerged(None, [('2', rev2)], tree.branch, tree2.branch,
206
199
tree2.merge_from_branch(tree3.branch)
207
200
rev6 = tree2.commit('six', rev_id='rev6')
209
self.assertUnmerged([], [('2', 'rev2', 0), ('3', 'rev3', 0),
202
self.assertUnmerged([], [('2', 'rev2', 0), ('3', 'rev3',0 ),
210
203
('4', 'rev6', 0),
211
204
('3.1.1', 'rev4', 1), ('3.1.2', 'rev5', 1),
213
tree.branch, tree2.branch,
206
tree.branch, tree2.branch, 'all',
214
207
include_merges=True)
216
209
self.assertUnmerged([], [('4', 'rev6', 0),
217
210
('3.1.2', 'rev5', 1), ('3.1.1', 'rev4', 1),
218
('3', 'rev3', 0), ('2', 'rev2', 0),
211
('3', 'rev3',0 ), ('2', 'rev2', 0),
220
tree.branch, tree2.branch,
213
tree.branch, tree2.branch, 'all',
221
214
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))