1
# Copyright (C) 2005 by Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4
17
from bzrlib.tests import TestCaseInTempDir
11
24
from bzrlib.workingtree import WorkingTree
12
25
from bzrlib.delta import compare_trees
14
28
class TestFileIdInvolved(TestCaseInTempDir):
16
30
def touch(self,filename):
41
54
main_branch = Branch.initialize('.')
42
55
self.build_tree(["a","b","c"])
45
commit(Branch.open("."), "Commit one", rev_id="rev-A")
59
wt.add(['a', 'b', 'c'], ['a-file-id-2006-01-01-abcd',
60
'b-file-id-2006-01-01-defg',
61
'c-funky<file-id> quiji%bo'])
62
commit(b, "Commit one", rev_id="rev-A")
46
64
#-------- end A -----------
48
66
copy_branch(main_branch,"../branch1")
99
116
self.merge("../branch1",force=True)
101
commit(Branch.open("."), "merge branch1, rev-12", rev_id="rev-D")
118
# D gets some funky characters to make sure the unescaping works
119
commit(Branch.open("."), "merge branch1, rev-12", rev_id="rev-<D>")
125
143
l = self.branch.fileid_involved_between_revs("rev-B","rev-K" )
126
144
self.assertEquals( sorted(map( lambda x: x[0], l )), ["b","c"])
128
l = self.branch.fileid_involved_between_revs("rev-C","rev-D" )
146
l = self.branch.fileid_involved_between_revs("rev-C","rev-<D>" )
129
147
self.assertEquals( sorted(map( lambda x: x[0], l )), ["b","d"])
131
149
l = self.branch.fileid_involved_between_revs("rev-C","rev-G" )
134
152
l = self.branch.fileid_involved_between_revs("rev-E","rev-G" )
135
153
self.assertEquals( sorted(map( lambda x: x[0], l )), ["a", "b","c","d"])
138
155
def test_fileid_involved_sets(self):
140
157
l = self.branch.fileid_involved_by_set(set(["rev-B"]))
141
158
self.assertEquals( sorted(map( lambda x: x[0], l )), ["a"])
143
l = self.branch.fileid_involved_by_set(set(["rev-D"]))
160
l = self.branch.fileid_involved_by_set(set(["rev-<D>"]))
144
161
self.assertEquals( sorted(map( lambda x: x[0], l )), ["b"])
146
163
def test_fileid_involved_compare(self):
148
l1 = self.branch.fileid_involved_between_revs("rev-E", "rev-D")
149
l2 = self.branch.fileid_involved_by_set(set(["rev-D","rev-F","rev-C","rev-B"]))
165
l1 = self.branch.fileid_involved_between_revs("rev-E", "rev-<D>")
166
l2 = self.branch.fileid_involved_by_set(set(["rev-<D>","rev-F","rev-C","rev-B"]))
150
167
self.assertEquals( l1, l2 )
152
169
l1 = self.branch.fileid_involved_between_revs("rev-C", "rev-G")
153
170
l2 = self.branch.fileid_involved_by_set(
154
set(["rev-G","rev-D","rev-F","rev-K","rev-J"]))
171
set(["rev-G","rev-<D>","rev-F","rev-K","rev-J"]))
155
172
self.assertEquals( l1, l2 )
157
174
def test_fileid_involved_full_compare(self):