~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-11 16:55:31 UTC
  • mfrom: (1998.1.1 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060911165531-9e9b9a022a53fef5
(moy) fixes for revno:N:branch/path

Show diffs side-by-side

added added

removed removed

Lines of Context:
1350
1350
        else:
1351
1351
            # local dir only
1352
1352
            # FIXME ? log the current subdir only RBC 20060203 
1353
 
            dir, relpath = bzrdir.BzrDir.open_containing('.')
 
1353
            if revision is not None \
 
1354
                    and len(revision) > 0 and revision[0].get_branch():
 
1355
                location = revision[0].get_branch()
 
1356
            else:
 
1357
                location = '.'
 
1358
            dir, relpath = bzrdir.BzrDir.open_containing(location)
1354
1359
            b = dir.open_branch()
1355
1360
 
1356
1361
        if revision is None:
1359
1364
        elif len(revision) == 1:
1360
1365
            rev1 = rev2 = revision[0].in_history(b).revno
1361
1366
        elif len(revision) == 2:
 
1367
            if revision[1].get_branch() != revision[0].get_branch():
 
1368
                # b is taken from revision[0].get_branch(), and
 
1369
                # show_log will use its revision_history. Having
 
1370
                # different branches will lead to weird behaviors.
 
1371
                raise BzrCommandError(
 
1372
                    "Log doesn't accept two revisions in different branches.")
1362
1373
            if revision[0].spec is None:
1363
1374
                # missing begin-range means first revision
1364
1375
                rev1 = 1
1652
1663
 
1653
1664
        if tree is None:
1654
1665
            b, relpath = Branch.open_containing(filename)
 
1666
        if revision is not None and revision[0].get_branch() is not None:
 
1667
            b = Branch.open(revision[0].get_branch())
1655
1668
        if revision is None:
1656
1669
            revision_id = b.last_revision()
1657
1670
        else:
2137
2150
                else:
2138
2151
                    return 1
2139
2152
 
2140
 
        branch = self._get_remembered_parent(tree, branch, 'Merging from')
 
2153
        if revision is None \
 
2154
                or len(revision) < 1 or revision[0].needs_branch():
 
2155
            branch = self._get_remembered_parent(tree, branch, 'Merging from')
2141
2156
 
2142
2157
        if revision is None or len(revision) < 1:
2143
2158
            if uncommitted:
2151
2166
            if uncommitted:
2152
2167
                raise BzrCommandError('Cannot use --uncommitted and --revision'
2153
2168
                                      ' at the same time.')
 
2169
            branch = revision[0].get_branch() or branch
2154
2170
            if len(revision) == 1:
2155
2171
                base = [None, None]
2156
2172
                other_branch, path = Branch.open_containing(branch)
2160
2176
                assert len(revision) == 2
2161
2177
                if None in revision:
2162
2178
                    raise BzrCommandError(
2163
 
                        "Merge doesn't permit that revision specifier.")
2164
 
                other_branch, path = Branch.open_containing(branch)
 
2179
                        "Merge doesn't permit empty revision specifier.")
 
2180
                base_branch, path = Branch.open_containing(branch)
 
2181
                branch1 = revision[1].get_branch() or branch
 
2182
                other_branch, path1 = Branch.open_containing(branch1)
 
2183
                if revision[0].get_branch() is not None:
 
2184
                    # then path was obtained from it, and is None.
 
2185
                    path = path1
2165
2186
 
2166
 
                base = [branch, revision[0].in_history(other_branch).revno]
2167
 
                other = [branch, revision[1].in_history(other_branch).revno]
 
2187
                base = [branch, revision[0].in_history(base_branch).revno]
 
2188
                other = [branch1, revision[1].in_history(other_branch).revno]
2168
2189
 
2169
2190
        if tree.branch.get_parent() is None or remember:
2170
2191
            tree.branch.set_parent(other_branch.base)