~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Olaf Conradi
  • Date: 2006-03-18 00:12:57 UTC
  • mto: (1661.1.1 bzr.mbp.remember)
  • mto: This revision was merged to the branch mainline in revision 1663.
  • Revision ID: olaf@conradi.org-20060318001257-bdb0088faae84e76
Merge now accepts option --remember to set parent location (closes #35350).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1779
1779
 
1780
1780
class cmd_merge(Command):
1781
1781
    """Perform a three-way merge.
 
1782
 
 
1783
    If there is no default location set, the first merge will set it. After
 
1784
    that, you can omit the location to use the default.  To change the
 
1785
    default, use --remember.
1782
1786
    
1783
1787
    The branch is the branch you will merge from.  By default, it will
1784
1788
    merge the latest revision.  If you specify a revision, that
1812
1816
    --force is given.
1813
1817
    """
1814
1818
    takes_args = ['branch?']
1815
 
    takes_options = ['revision', 'force', 'merge-type', 'reprocess',
 
1819
    takes_options = ['remember', 'revision', 'force', 'merge-type', 'reprocess',
1816
1820
                     Option('show-base', help="Show base revision text in "
1817
1821
                            "conflicts")]
1818
1822
 
1819
 
    def run(self, branch=None, revision=None, force=False, merge_type=None,
 
1823
    def run(self, branch=None, remember=False, revision=None, force=False, merge_type=None,
1820
1824
            show_base=False, reprocess=False):
 
1825
        tree = WorkingTree.open_containing(u'.')[0]
1821
1826
        if merge_type is None:
1822
1827
            merge_type = Merge3Merger
1823
1828
        if branch is None:
1824
 
            branch = WorkingTree.open_containing(u'.')[0].branch.get_parent()
 
1829
            branch = tree.branch.get_parent()
1825
1830
            if branch is None:
1826
1831
                raise BzrCommandError("No merge location known or specified.")
1827
1832
            else:
1857
1862
            if conflict_count != 0:
1858
1863
                return 1
1859
1864
            else:
 
1865
                if tree.branch.get_parent() is None or remember:
 
1866
                    tree.branch.set_parent(branch)
1860
1867
                return 0
1861
1868
        except bzrlib.errors.AmbiguousBase, e:
1862
1869
            m = ("sorry, bzr can't determine the right merge base yet\n"