~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to gen_changeset.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-02 07:20:08 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050702072008-26d6e862eff44079
Several fixes for handling the case where you are doing a changeset against revno=0 (Null base)

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        write = self._write
171
171
 
172
172
        # What should we print out for an Empty base revision?
173
 
        assumed_base = self.revision_list[0].parents[0].revision_id
174
 
        if self.base_revision.revision_id != assumed_base:
 
173
        if len(self.revision_list[0].parents) == 0:
 
174
            assumed_base = None
 
175
        else:
 
176
            assumed_base = self.revision_list[0].parents[0].revision_id
 
177
        if (self.base_revision is not None 
 
178
                and self.base_revision.revision_id != assumed_base):
175
179
            base = self.base_revision.revision_id
176
180
            write(base, key='base')
177
181
            write(self.branch.get_revision_sha1(base), key='base sha1')
198
202
            if rev.inventory_id != rev_id:
199
203
                self.to_file.write('#    inventory id: %s\n' % rev.inventory_id)
200
204
            self.to_file.write('#    inventory sha1: %s\n' % rev.inventory_sha1)
201
 
            self.to_file.write('#    parents:\n')
202
 
            for parent in rev.parents:
203
 
                self.to_file.write('#       %s\t%s\n' % (
204
 
                    parent.revision_id,
205
 
                    parent.revision_sha1))
 
205
            if len(rev.parents) > 0:
 
206
                self.to_file.write('#    parents:\n')
 
207
                for parent in rev.parents:
 
208
                    self.to_file.write('#       %s\t%s\n' % (
 
209
                        parent.revision_id,
 
210
                        parent.revision_sha1))
206
211
            if rev.message and rev.message != self.message:
207
212
                self.to_file.write('#    message:\n')
208
213
                for line in rev.message.split('\n'):