~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-01-31 16:57:25 UTC
  • mfrom: (2247.1.1 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070131165725-e3091cb8d282ef90
fix --Derror => -Derror (trivial)

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
        """Given a revision id, return its revno"""
361
361
        if revision_id is None:
362
362
            return 0
363
 
        revision_id = osutils.safe_revision_id(revision_id)
364
363
        history = self.revision_history()
365
364
        try:
366
365
            return history.index(revision_id) + 1
546
545
        """
547
546
        new_history = self.revision_history()
548
547
        if revision_id is not None:
549
 
            revision_id = osutils.safe_revision_id(revision_id)
550
548
            try:
551
549
                new_history = new_history[:new_history.index(revision_id) + 1]
552
550
            except ValueError:
1129
1127
    @needs_write_lock
1130
1128
    def set_revision_history(self, rev_history):
1131
1129
        """See Branch.set_revision_history."""
1132
 
        rev_history = [osutils.safe_revision_id(r) for r in rev_history]
1133
 
        self.control_files.put_bytes(
 
1130
        self.control_files.put_utf8(
1134
1131
            'revision-history', '\n'.join(rev_history))
1135
1132
        transaction = self.get_transaction()
1136
1133
        history = transaction.map.find_revision_history()
1156
1153
        if history is not None:
1157
1154
            # mutter("cache hit for revision-history in %s", self)
1158
1155
            return list(history)
1159
 
        get_cached_utf8 = cache_utf8.get_cached_utf8
1160
 
        history = [get_cached_utf8(l.rstrip('\r\n')) for l in
 
1156
        decode_utf8 = cache_utf8.decode
 
1157
        history = [decode_utf8(l.rstrip('\r\n')) for l in
1161
1158
                self.control_files.get('revision-history').readlines()]
1162
1159
        transaction.map.add_revision_history(history)
1163
1160
        # this call is disabled because revision_history is 
1176
1173
        :param other_branch: The other branch that DivergedBranches should
1177
1174
            raise with respect to.
1178
1175
        """
1179
 
        revision_id = osutils.safe_revision_id(revision_id)
1180
1176
        # stop_revision must be a descendant of last_revision
1181
1177
        stop_graph = self.repository.get_revision_graph(revision_id)
1182
1178
        if last_rev is not None and last_rev not in stop_graph:
1205
1201
                if stop_revision is None:
1206
1202
                    # if there are no commits, we're done.
1207
1203
                    return
1208
 
            else:
1209
 
                stop_revision = osutils.safe_revision_id(stop_revision)
1210
1204
            # whats the current last revision, before we fetch [and change it
1211
1205
            # possibly]
1212
1206
            last_rev = self.last_revision()
1305
1299
                        "use bzrlib.urlutils.escape")
1306
1300
                    
1307
1301
            url = urlutils.relative_url(self.base, url)
1308
 
            self.control_files.put_bytes('parent', url + '\n')
 
1302
            self.control_files.put('parent', StringIO(url + '\n'))
1309
1303
 
1310
1304
    @deprecated_function(zero_nine)
1311
1305
    def tree_config(self):