~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Robert Collins
  • Date: 2005-10-29 23:48:45 UTC
  • Revision ID: robertc@robertcollins.net-20051029234845-7ae4e7d118bdd3ed
Implement a 'bzr push' command, with saved locations; update diff to return 1.

    * 'bzr diff' now returns 1 when there are changes in the working 
      tree.

    * 'bzr push' now exists and can push changes to a remote location. 
      This uses the transport infrastructure, and can store the remote
      location in the ~/.bazaar/branches.conf configuration file.

    * WorkingTree.pull has been split across Branch and WorkingTree,
      to allow Branch only pulls.

    * commands.display_command now returns the result of the decorated 
      function.

    * LocationConfig now has a set_user_option(key, value) call to save
      a setting in its matching location section (a new one is created
      if needed).

    * Branch has two new methods, get_push_location and set_push_location
      to respectively, get and set the push location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
954
954
        # for that.
955
955
        return WorkingTree(self.base, branch=self)
956
956
 
 
957
    @needs_write_lock
 
958
    def pull(self, source, overwrite=False):
 
959
        source.lock_read()
 
960
        try:
 
961
            try:
 
962
                self.update_revisions(source)
 
963
            except DivergedBranches:
 
964
                if not overwrite:
 
965
                    raise
 
966
                self.set_revision_history(source.revision_history())
 
967
        finally:
 
968
            source.unlock()
957
969
 
958
970
    def basis_tree(self):
959
971
        """Return `Tree` object for last revision.
1165
1177
                    raise
1166
1178
        return None
1167
1179
 
 
1180
    def get_push_location(self):
 
1181
        """Return the None or the location to push this branch to."""
 
1182
        config = bzrlib.config.BranchConfig(self)
 
1183
        push_loc = config.get_user_option('push_location')
 
1184
        return push_loc
 
1185
 
 
1186
    def set_push_location(self, location):
 
1187
        """Set a new push location for this branch."""
 
1188
        config = bzrlib.config.LocationConfig(self.base)
 
1189
        config.set_user_option('push_location', location)
 
1190
 
1168
1191
    @needs_write_lock
1169
1192
    def set_parent(self, url):
1170
1193
        # TODO: Maybe delete old location files?