[merge] Re: how to revert update operation

Adeodato Simó dato at net.com.org.es
Fri Jul 28 12:40:45 BST 2006


* John Arbash Meinel [Fri, 21 Jul 2006 12:26:01 -0500]:

Hi, sorry for the delay, forgot this was still lying around.

> Adeodato Simó wrote:

> > 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.

> Just to be clear. I do think we should have commit push revisions. But I
> wanted to bring up one of the reasons it wasn't, in case it comes up
> later, or someone decides that it is a big deal.

Ah, ok. In that case, I've dropped the reference to 'push'; feel free to
mention it in the message in any way you deem appropriate.

> > === 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

> The note looks pretty good. 3 comments:
> 1) I don't think we use backticks when reporting things to the user.
> 2) committed has 2 t's

Fixed.

> 3) If you did 'bzr merge ../other/tree' and then 'bzr upgrade' because
> you tree was out of date, you wouldn't have any local commits, but you
> would have pending merges. So probably the check should be done earlier,
> and carried over to here to be reported.

Uuh, I failed to think of that, many thanks for spotting. Fixed in a
hopefully correct way. (My only doubt was whether to sort the arrays
before the comparison, but I don't see it'd be needed.)

> >              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.')

> I wouldn't put '\n' in the middle string if I was splitting across
> lines. So more like:
> 'push if the branches have not diverged.\n'
> 'You can also...'

> That makes it more obvious that we are breaking the line.

> You don't need '\' at the end of the line, because you are inside
> parentheses, so you already have a continuation until the final closing
> parenthesis.

Fixed.

> I don't think we should be getting 'OutOfDate' if the child branch is a
> superset of the master branch. Some other error would be okay, but it
> should be distinguished whether the parent has more entries (need to
> update), child has more entries (need to push), or both have entries
> (need to merge).

This should be part of the fix to #53493, yes? In any case, not feeling
confident enough to mess with changes like this (yet). ;-)

> But if fixing that is too complex, try this text:

> To commit to master branch, run update (or push if the child has local
> commits).
> You can also use 'commit --local' to continue working disconnected.

> (I don't *really* like "working disconnected", but the user isn't
> offline at this point).

Ok, changed. Feel free to make any adjustments yourself before
comitting, or suggesting that I improve something else myself.

Cheers,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
«¡Pero si es tan español que debe de tener el cerebro en forma de botijo,
con pitorro y todo!»
                -- Javier Cercas, “La velocidad de la luz”
-------------- next part --------------
# Bazaar revision bundle v0.8
#
# message:
#   [merge] bzr.dev 1887
# committer: Adeodato Simó <dato at net.com.org.es>
# date: Fri 2006-07-28 13:11:56.227999926 +0200

=== modified file bzrlib/builtins.py
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -814,6 +814,7 @@
     def run(self, dir='.'):
         tree = WorkingTree.open_containing(dir)[0]
         tree.lock_write()
+        existing_pending_merges = tree.pending_merges()
         try:
             last_rev = tree.last_revision() 
             if last_rev == tree.branch.last_revision():
@@ -826,6 +827,9 @@
             conflicts = tree.update()
             revno = tree.branch.revision_id_to_revno(tree.last_revision())
             note('Updated to revision %d.' % (revno,))
+            if tree.pending_merges() != existing_pending_merges:
+                note('Your local commits will show now as pending merges with '
+                     "'bzr status', and can be committed with 'bzr commit'.")
             if conflicts != 0:
                 return 1
             else:
@@ -1759,10 +1763,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, run update and then commit.\n'
+                'You can also pass --local to commit to continue working '
+                'disconnected.')
 
 class cmd_check(Command):
     """Validate consistency of branch history.

# revision id: dato at net.com.org.es-20060728111156-d25f0d0cf5f7a108
# sha1: a15604dc7b5e54ac6e1c87f0eb3e06100bf0ea93
# inventory sha1: ec3c3b36274ae2f304a790f021250cfd4966b6d1
# parent ids:
#   dato at net.com.org.es-20060728111048-79626543aa70e3b0
#   pqm at pqm.ubuntu.com-20060727200511-3bfb6377b1695fad
# base id: pqm at pqm.ubuntu.com-20060727200511-3bfb6377b1695fad
# properties:
#   branch-nick: bzr.dev.improve-msgs

# message:
#   Update with suggestions from John Arbash Meinel.
#   
# committer: Adeodato Simó <dato at net.com.org.es>
# date: Fri 2006-07-28 13:10:48.805000067 +0200

=== modified file bzrlib/builtins.py // encoding:base64
LS0tIGJ6cmxpYi9idWlsdGlucy5weQorKysgYnpybGliL2J1aWx0aW5zLnB5CkBAIC04MTQsNiAr
ODE0LDcgQEAKICAgICBkZWYgcnVuKHNlbGYsIGRpcj0nLicpOgogICAgICAgICB0cmVlID0gV29y
a2luZ1RyZWUub3Blbl9jb250YWluaW5nKGRpcilbMF0KICAgICAgICAgdHJlZS5sb2NrX3dyaXRl
KCkKKyAgICAgICAgZXhpc3RpbmdfcGVuZGluZ19tZXJnZXMgPSB0cmVlLnBlbmRpbmdfbWVyZ2Vz
KCkKICAgICAgICAgdHJ5OgogICAgICAgICAgICAgbGFzdF9yZXYgPSB0cmVlLmxhc3RfcmV2aXNp
b24oKSAKICAgICAgICAgICAgIGlmIGxhc3RfcmV2ID09IHRyZWUuYnJhbmNoLmxhc3RfcmV2aXNp
b24oKToKQEAgLTgyNiw5ICs4MjcsOSBAQAogICAgICAgICAgICAgY29uZmxpY3RzID0gdHJlZS51
cGRhdGUoKQogICAgICAgICAgICAgcmV2bm8gPSB0cmVlLmJyYW5jaC5yZXZpc2lvbl9pZF90b19y
ZXZubyh0cmVlLmxhc3RfcmV2aXNpb24oKSkKICAgICAgICAgICAgIG5vdGUoJ1VwZGF0ZWQgdG8g
cmV2aXNpb24gJWQuJyAlIChyZXZubywpKQotICAgICAgICAgICAgaWYgdHJlZS5wZW5kaW5nX21l
cmdlcygpOgorICAgICAgICAgICAgaWYgdHJlZS5wZW5kaW5nX21lcmdlcygpICE9IGV4aXN0aW5n
X3BlbmRpbmdfbWVyZ2VzOgogICAgICAgICAgICAgICAgIG5vdGUoJ1lvdXIgbG9jYWwgY29tbWl0
cyB3aWxsIHNob3cgbm93IGFzIHBlbmRpbmcgbWVyZ2VzIHdpdGggJwotICAgICAgICAgICAgICAg
ICAgICAgJ2BienIgc3RhdHVzYCwgYW5kIGNhbiBiZSBjb21taXRlZCB3aXRoIGBienIgY29tbWl0
YC4nKQorICAgICAgICAgICAgICAgICAgICAgIidienIgc3RhdHVzJywgYW5kIGNhbiBiZSBjb21t
aXR0ZWQgd2l0aCAnYnpyIGNvbW1pdCcuIikKICAgICAgICAgICAgIGlmIGNvbmZsaWN0cyAhPSAw
OgogICAgICAgICAgICAgICAgIHJldHVybiAxCiAgICAgICAgICAgICBlbHNlOgpAQCAtMTc1OCwx
MCArMTc1OSw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZpbGVzIGlu
IHRoZSB3b3JraW5nIHRyZWUuIikKICAgICAgICAgZXhjZXB0IGVycm9ycy5Cb3VuZEJyYW5jaE91
dE9mRGF0ZSwgZToKICAgICAgICAgICAgIHJhaXNlIEJ6ckNvbW1hbmRFcnJvcihzdHIoZSkgKyAi
XG4iCi0gICAgICAgICAgICAgICAgJ1RvIGNvbW1pdCB0byBtYXN0ZXIgYnJhbmNoLCBkbyB1cGRh
dGUgYW5kIHRoZW4gY29tbWl0LCBvciAnICBcCi0gICAgICAgICAgICAgICAgJ3B1c2ggaWYgdGhl
IGJyYW5jaGVzIGhhdmUgbm90IGRpdmVyZ2VkLlxuWW91IGNhbiBhbHNvIHBhc3MgJyBcCi0gICAg
ICAgICAgICAgICAgJy0tbG9jYWwgdG8gY29tbWl0IHRvIGNvbnRpbnVlIHdvcmtpbmcgb2ZmbGlu
ZS4nKQotCisgICAgICAgICAgICAgICAgJ1RvIGNvbW1pdCB0byBtYXN0ZXIgYnJhbmNoLCBydW4g
dXBkYXRlIGFuZCB0aGVuIGNvbW1pdC5cbicKKyAgICAgICAgICAgICAgICAnWW91IGNhbiBhbHNv
IHBhc3MgLS1sb2NhbCB0byBjb21taXQgdG8gY29udGludWUgd29ya2luZyAnCisgICAgICAgICAg
ICAgICAgJ2Rpc2Nvbm5lY3RlZC4nKQogCiBjbGFzcyBjbWRfY2hlY2soQ29tbWFuZCk6CiAgICAg
IiIiVmFsaWRhdGUgY29uc2lzdGVuY3kgb2YgYnJhbmNoIGhpc3RvcnkuCgo=

# revision id: dato at net.com.org.es-20060728111048-79626543aa70e3b0
# sha1: 9ea1620732a40552cf4e510bddd74ad075e7f2ff
# inventory sha1: 385ec74dc4346e0627a0ea36ea64739de4761e18
# parent ids:
#   dato at net.com.org.es-20060721170007-bea76c69779e80e8
# properties:
#   branch-nick: bzr.dev.improve-msgs

# 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 // encoding:base64
LS0tIGJ6cmxpYi9idWlsdGlucy5weQorKysgYnpybGliL2J1aWx0aW5zLnB5CkBAIC04MjYsNiAr
ODI2LDkgQEAKICAgICAgICAgICAgIGNvbmZsaWN0cyA9IHRyZWUudXBkYXRlKCkKICAgICAgICAg
ICAgIHJldm5vID0gdHJlZS5icmFuY2gucmV2aXNpb25faWRfdG9fcmV2bm8odHJlZS5sYXN0X3Jl
dmlzaW9uKCkpCiAgICAgICAgICAgICBub3RlKCdVcGRhdGVkIHRvIHJldmlzaW9uICVkLicgJSAo
cmV2bm8sKSkKKyAgICAgICAgICAgIGlmIHRyZWUucGVuZGluZ19tZXJnZXMoKToKKyAgICAgICAg
ICAgICAgICBub3RlKCdZb3VyIGxvY2FsIGNvbW1pdHMgd2lsbCBzaG93IG5vdyBhcyBwZW5kaW5n
IG1lcmdlcyB3aXRoICcKKyAgICAgICAgICAgICAgICAgICAgICdgYnpyIHN0YXR1c2AsIGFuZCBj
YW4gYmUgY29tbWl0ZWQgd2l0aCBgYnpyIGNvbW1pdGAuJykKICAgICAgICAgICAgIGlmIGNvbmZs
aWN0cyAhPSAwOgogICAgICAgICAgICAgICAgIHJldHVybiAxCiAgICAgICAgICAgICBlbHNlOgpA
QCAtMTc1NCw5ICsxNzU3LDEwIEBACiAgICAgICAgICAgICByYWlzZSBCenJDb21tYW5kRXJyb3Io
IkNvbW1pdCByZWZ1c2VkIGJlY2F1c2UgdGhlcmUgYXJlIHVua25vd24gIgogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICJmaWxlcyBpbiB0aGUgd29ya2luZyB0cmVlLiIpCiAgICAg
ICAgIGV4Y2VwdCBlcnJvcnMuQm91bmRCcmFuY2hPdXRPZkRhdGUsIGU6Ci0gICAgICAgICAgICBy
YWlzZSBCenJDb21tYW5kRXJyb3Ioc3RyKGUpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgKyAnIEVpdGhlciB1bmJpbmQsIHVwZGF0ZSwgb3InCi0gICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAnIHBhc3MgLS1sb2NhbCB0byBjb21taXQuJykKKyAgICAgICAgICAg
IHJhaXNlIEJ6ckNvbW1hbmRFcnJvcihzdHIoZSkgKyAiXG4iCisgICAgICAgICAgICAgICAgJ1Rv
IGNvbW1pdCB0byBtYXN0ZXIgYnJhbmNoLCBkbyB1cGRhdGUgYW5kIHRoZW4gY29tbWl0LCBvciAn
ICBcCisgICAgICAgICAgICAgICAgJ3B1c2ggaWYgdGhlIGJyYW5jaGVzIGhhdmUgbm90IGRpdmVy
Z2VkLlxuWW91IGNhbiBhbHNvIHBhc3MgJyBcCisgICAgICAgICAgICAgICAgJy0tbG9jYWwgdG8g
Y29tbWl0IHRvIGNvbnRpbnVlIHdvcmtpbmcgb2ZmbGluZS4nKQogCiAKIGNsYXNzIGNtZF9jaGVj
ayhDb21tYW5kKToKCg==

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



More information about the bazaar mailing list