~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

merge up with HEAD and with test-fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
    def __init__(self, base, init=False, find_root=True):
166
166
        """Create new branch object at a particular location.
167
167
 
168
 
        base -- Base directory for the branch.
 
168
        base -- Base directory for the branch. May be a file:// url.
169
169
        
170
170
        init -- If True, create new control files in a previously
171
171
             unversioned directory.  If False, the branch must already
184
184
        elif find_root:
185
185
            self.base = find_branch_root(base)
186
186
        else:
 
187
            if base.startswith("file://"):
 
188
                base = base[7:]
187
189
            self.base = os.path.realpath(base)
188
190
            if not isdir(self.controlfilename('.')):
189
191
                raise NotBranchError("not a bzr branch: %s" % quotefn(base),
209
211
            warn("branch %r was not explicitly unlocked" % self)
210
212
            self._lock.unlock()
211
213
 
212
 
 
213
214
    def lock_write(self):
214
215
        if self._lock_mode:
215
216
            if self._lock_mode != 'w':
796
797
        """Pull in all new revisions from other branch.
797
798
        """
798
799
        from bzrlib.fetch import greedy_fetch
 
800
        from bzrlib.revision import get_intervening_revisions
799
801
 
800
802
        pb = bzrlib.ui.ui_factory.progress_bar()
801
803
        pb.update('comparing histories')
802
804
 
803
 
        revision_ids = self.missing_revisions(other, stop_revision)
 
805
        try:
 
806
            revision_ids = self.missing_revisions(other, stop_revision)
 
807
        except DivergedBranches, e:
 
808
            try:
 
809
                if stop_revision is None:
 
810
                    end_revision = other.last_patch()
 
811
                revision_ids = get_intervening_revisions(self.last_patch(), 
 
812
                                                         end_revision, other)
 
813
                assert self.last_patch() not in revision_ids
 
814
            except bzrlib.errors.NotAncestor:
 
815
                raise e
804
816
 
805
817
        if len(revision_ids) > 0:
806
818
            count = greedy_fetch(self, other, revision_ids[-1], pb)[0]
1507
1519
    merge((to_location, -1), (to_location, 0), this_dir=to_location,
1508
1520
          check_clean=False, ignore_zero=True)
1509
1521
    
1510
 
    from_location = branch_from.base
1511
1522
    br_to.set_parent(branch_from.base)
1512