[merge] Re: how to revert update operation

Adeodato Simó dato at net.com.org.es
Fri Jul 21 18:01:00 BST 2006


* Robert Collins [Thu, 20 Jul 2006 13:19:49 +1000]:

> On Thu, 2006-07-20 at 05:02 +0200, Adeodato Simó wrote:

>> * Robert Collins [Thu, 20 Jul 2006 12:32:55 +1000]:

>>> We should not offer --local, or push, if its a lightweight checkout
>>> we're working with rather than a heavyweight checkout. (because they
>>> dont apply there).

> > Oh, right, forgot about lightcheckouts. Is it reasonable to check for
> > that, and only add the second sentence for heavyweight checkouts?

> I think so.

Oh, huh. After looking more carefully, I disagree that there is the need
for a check.

At first, and following your suggestion, I went and wrote something like:

  except errors.BoundBranchOutOfDate, e:
      error = "To commit to master branch, do update and then commit"
      if not lightweight_checkout:
          error += "\nYou can also pass --local to commit to continue " \
                   "working offline."

However, I realized afterwards that that exception is not raised for
lightweight checkouts (they get OutOfDateTree), _except_ if they are a
lightweight checkout _of a checkout_, in which case both --local and
push work.

With the above explanations, I think that the attached patch should be
ok. Note that I've left the reference to push in place, since it's not
clear how http://launchpad.net/bugs/53493 will be fixed (particularly
after John's comment), so I'd rather have it mentioned for now, since I
really believe it can be of help to users.

And I've also added Erik's suggestion for update, that is, to print a
note saying what happened to the local commits.

Feel free to make me iterate over the patch again, or address this
concerns in another one of yours, but I think useability would improve a
bit with it. :)

Thanks.

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
                                   Listenin to: Alejandro Sanz - Labana
-------------- next part --------------
# Bazaar revision bundle v0.8
#
# message:
#   cmd_commit.run:
#       - improve error message for BoundBranchOutOfDate.
#   
#   cmd_update.run:
#       - print a note if local commits are now a pending merge.
#   
# committer: Adeodato Simó <dato at net.com.org.es>
# date: Fri 2006-07-21 19:00:07.369999886 +0200

=== modified file bzrlib/builtins.py
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -826,6 +826,9 @@
             conflicts = tree.update()
             revno = tree.branch.revision_id_to_revno(tree.last_revision())
             note('Updated to revision %d.' % (revno,))
+            if tree.pending_merges():
+                note('Your local commits will show now as pending merges with '
+                     '`bzr status`, and can be commited with `bzr commit`.')
             if conflicts != 0:
                 return 1
             else:
@@ -1754,9 +1757,10 @@
             raise BzrCommandError("Commit refused because there are unknown "
                                   "files in the working tree.")
         except errors.BoundBranchOutOfDate, e:
-            raise BzrCommandError(str(e)
-                                  + ' Either unbind, update, or'
-                                    ' pass --local to commit.')
+            raise BzrCommandError(str(e) + "\n"
+                'To commit to master branch, do update and then commit, or '  \
+                'push if the branches have not diverged.\nYou can also pass ' \
+                '--local to commit to continue working offline.')
 
 
 class cmd_check(Command):

# revision id: dato at net.com.org.es-20060721170007-bea76c69779e80e8
# sha1: 2d531b7c549bd0d153be27f1538c65556267e990
# inventory sha1: 0285ccade6ad305dd31be8fcf9fdcc4377f7e4e6
# parent ids:
#   pqm at pqm.ubuntu.com-20060721054643-20c103c916447e25
# base id: pqm at pqm.ubuntu.com-20060721054643-20c103c916447e25
# properties:
#   branch-nick: bzr.dev.improve-msgs



More information about the bazaar mailing list