[bug] 'bzr update' uses pending_merges()

John Arbash Meinel john at arbash-meinel.com
Tue Sep 12 04:42:27 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When Robert deprecated 'pending_merges()' he seemed to miss the use by
'bzr update'.

Update uses:
existing_pending_merges = tree.pending_merges()
and then
if tree.pending_merges() != existing_pending_merges:

To see if it needs to alert the user that it moved the user's commits
into pending merges.

This patch works around the deprecation warning, but I'm wondering if
Robert had a different idea in mind.

The basic idea of 'bzr update' is that it wants to let the user know
where their commits have gone. But if you have done 'bzr merge ../foo;
bzr update', we don't want to warn that there are pending merges that we
haven't changed.
We can't look at the complete list of parents, because we expect 'bzr
update' to change the last revision, but not necessarily the rest.

The other possibility would be to have 'tree.update()' return a value
indicating if it had to change local commits into merges.

John
=:->




=== modified file 'bzrlib/builtins.py'
- --- bzrlib/builtins.py  2006-09-08 18:46:29 +0000
+++ bzrlib/builtins.py  2006-09-12 03:38:18 +0000
@@ -823,7 +823,7 @@
         tree = WorkingTree.open_containing(dir)[0]
         tree.lock_write()
         try:
- -            existing_pending_merges = tree.pending_merges()
+            existing_pending_merges = tree.get_parent_ids()[1:]
             last_rev = tree.last_revision()
             if last_rev == tree.branch.last_revision():
                 # may be up to date, check master too.
@@ -835,7 +835,7 @@
             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:
+            if tree.get_parent_ids()[1:] != existing_pending_merges:
                 note('Your local commits will now show as pending
merges with '
                      "'bzr status', and can be committed with 'bzr
commit'.")
             if conflicts != 0:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBiyjJdeBCYSNAAMRAud3AJ94zOzQTY291Ak8Z33fWSVKza1mwQCdEw2N
BHpsLdfvAwKjEKQfg+P1/cw=
=kRZ1
-----END PGP SIGNATURE-----




More information about the bazaar mailing list