~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-20 16:42:28 UTC
  • mto: This revision was merged to the branch mainline in revision 4819.
  • Revision ID: john@arbash-meinel.com-20091120164228-aa9agsdfomwzqshc
Fix bug #485771. Only change '/' to '/' when expanding globs.

The code we had would replace '/' even if it was in a quoted section,
or if it was part of a simple argument that didn't have a glob.

Show diffs side-by-side

added added

removed removed

Lines of Context:
503
503
                left_parent = stop_rev.parent_ids[0]
504
504
            else:
505
505
                left_parent = _mod_revision.NULL_REVISION
506
 
            # left_parent is the actual revision we want to stop logging at,
507
 
            # since we want to show the merged revisions after the stop_rev too
508
 
            reached_stop_revision_id = False
509
 
            revision_id_whitelist = []
510
506
            for node in rev_iter:
511
507
                rev_id = node.key[-1]
512
508
                if rev_id == left_parent:
513
 
                    # reached the left parent after the stop_revision
514
509
                    return
515
 
                if (not reached_stop_revision_id or
516
 
                        rev_id in revision_id_whitelist):
517
 
                    yield (rev_id, node.merge_depth, node.revno,
 
510
                yield (rev_id, node.merge_depth, node.revno,
518
511
                       node.end_of_merge)
519
 
                    if reached_stop_revision_id or rev_id == stop_revision_id:
520
 
                        # only do the merged revs of rev_id from now on
521
 
                        rev = self.repository.get_revision(rev_id)
522
 
                        if rev.parent_ids:
523
 
                            reached_stop_revision_id = True
524
 
                            revision_id_whitelist.extend(rev.parent_ids)
525
512
        else:
526
513
            raise ValueError('invalid stop_rule %r' % stop_rule)
527
514
 
1298
1285
        # clone call. Or something. 20090224 RBC/spiv.
1299
1286
        if revision_id is None:
1300
1287
            revision_id = self.last_revision()
1301
 
        dir_to = self.bzrdir.clone_on_transport(to_transport,
1302
 
            revision_id=revision_id, stacked_on=stacked_on,
1303
 
            create_prefix=create_prefix, use_existing_dir=use_existing_dir)
 
1288
        try:
 
1289
            dir_to = self.bzrdir.clone_on_transport(to_transport,
 
1290
                revision_id=revision_id, stacked_on=stacked_on,
 
1291
                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
 
1292
        except errors.FileExists:
 
1293
            if not use_existing_dir:
 
1294
                raise
 
1295
        except errors.NoSuchFile:
 
1296
            if not create_prefix:
 
1297
                raise
1304
1298
        return dir_to.open_branch()
1305
1299
 
1306
1300
    def create_checkout(self, to_location, revision_id=None,
1446
1440
        """Return the format for the branch object in a_bzrdir."""
1447
1441
        try:
1448
1442
            transport = a_bzrdir.get_branch_transport(None)
1449
 
            format_string = transport.get_bytes("format")
 
1443
            format_string = transport.get("format").read()
1450
1444
            return klass._formats[format_string]
1451
1445
        except errors.NoSuchFile:
1452
1446
            raise errors.NotBranchError(path=transport.base)
1985
1979
    def get_reference(self, a_bzrdir):
1986
1980
        """See BranchFormat.get_reference()."""
1987
1981
        transport = a_bzrdir.get_branch_transport(None)
1988
 
        return transport.get_bytes('location')
 
1982
        return transport.get('location').read()
1989
1983
 
1990
1984
    def set_reference(self, a_bzrdir, to_branch):
1991
1985
        """See BranchFormat.set_reference()."""
2143
2137
        # All-in-one needs to always unlock/lock.
2144
2138
        repo_control = getattr(self.repository, 'control_files', None)
2145
2139
        if self.control_files == repo_control or not self.is_locked():
2146
 
            self.repository._warn_if_deprecated(self)
2147
2140
            self.repository.lock_write()
2148
2141
            took_lock = True
2149
2142
        else:
2161
2154
        # All-in-one needs to always unlock/lock.
2162
2155
        repo_control = getattr(self.repository, 'control_files', None)
2163
2156
        if self.control_files == repo_control or not self.is_locked():
2164
 
            self.repository._warn_if_deprecated(self)
2165
2157
            self.repository.lock_read()
2166
2158
            took_lock = True
2167
2159
        else: