9
9
"""Turn some sort of revision information into a single
10
10
set of from-to revision ids.
12
A revision id can be none if there is no associated revison.
12
A revision id can be None if there is no associated revison.
14
16
# This is a little clumsy because revision parsing may return
15
17
# a single entry, or a list
34
36
if new is not None:
35
37
new = branch.lookup_revision(new)
37
# Get the ancestor previous version
38
rev = branch.get_revision(new)
41
old = branch.lookup_revision(old)
39
old = branch.last_patch()
44
old = branch.last_patch()
46
old = branch.lookup_revision(old)
41
old = branch.lookup_revision(old)
100
95
if rev == revisions[1]:
98
self.revision_list = []
103
99
if old_revno is None:
104
raise bzrlib.errors.BzrError('Could not find revision for %s' % revisions[0])
106
self.revision_list = []
100
self.base_revision = None
103
self.base_revision = self.branch.get_revision(rh[old_revno])
107
104
if new_revno is not None:
108
for rev_id in rh[old_revno:new_revno+1]:
105
for rev_id in rh[old_revno+1:new_revno+1]:
109
106
self.revision_list.append(self.branch.get_revision(rev_id))
111
for rev_id in rh[old_revno:]:
108
for rev_id in rh[old_revno+1:]:
112
109
self.revision_list.append(self.branch.get_revision(rev_id))
113
110
self.revision_list.append(_fake_working_revision(self.branch))
115
112
def write_meta_info(self, to_file):
116
113
"""Write out the meta-info portion to the supplied file."""
117
114
from bzrlib.osutils import username
118
def write(key, value):
119
to_file.write('# ' + key + ': ' + value + '\n')
121
write('committer', username())
115
def write(txt, key=None):
117
to_file.write('# ' + key + ': ' + txt + '\n')
119
to_file.write('# ' + txt + '\n')
121
write(username(), key='committer')
123
if self.base_revision:
124
write(self.base_revision.revision_id, key='precursor')
127
for rev in self.revision_list:
128
if rev.revision_id is not None:
130
write(rev.revision_id, key='revisions')
133
write('\t' + rev.revision_id)
124
136
def show_changeset(branch, revision=None, specific_files=None,