bzr push should default to parent branch if that's writable

Bug #539996 reported by Scott James Remnant (Canonical) on 2010-03-17
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Wishlist
Unassigned
Breezy
Wishlist
Unassigned

Bug Description

Here's a very common work flow:

   bzr branch lp:something
   cd something
   hack
   bzr commit
   bzr push

bzr decides to be unhelpful, and the "bzr push" fails.

I think it's not unreasonable for this to at least *try* to push to the parent branch; if that fails, then sure, say no push location defined. If you own the branch, it's very likely that it's the branch you meant to push to.

(Ubuntu developers follow this work flow every time they hack on a package for example)

Another obvious solution, if changing push isn't possible, would be to set the push location at branch-time if the branch was writable - the lp plugin at least knows that, and I'm sure the other URLs (bzr+ssh for example) tell you whether it's writable or not

Martin Pool (mbp) wrote :

I'm not sure that would be a safe default for all workflows but it's an interesting suggestion.

As a workaround you should be able to do 'bzr push --remember :parent'.

See also bug 538887.

tags: added: location-aliases
Changed in bzr:
status: New → Confirmed
importance: Undecided → Wishlist
tags: added: location-alias ui
removed: location-aliases

On Wed, 2010-03-17 at 01:23 +0000, Martin Pool wrote:

> I'm not sure that would be a safe default for all workflows but it's an
> interesting suggestion.
>
If they can write to the branch, why would it be unsafe? If they didn't
mean to push there, they wouldn't have typed "push" unguarded - and they
have permission to uncommit and push --overwrite as well.

> As a workaround you should be able to do 'bzr push --remember :parent'.
>
Yes, but bzr is just being annoying ;)

bzr papercut! :D

Scott
--
Scott James Remnant
<email address hidden>

Robert Collins (lifeless) wrote :

On Wed, 2010-03-17 at 02:02 +0000, Scott James Remnant wrote:
>
> If they can write to the branch, why would it be unsafe? If they
> didn't
> mean to push there, they wouldn't have typed "push" unguarded

They might not know that bzr would push to that branch; they might have
thought they had set an explicit target and hadn't.

> - and they
> have permission to uncommit and push --overwrite as well.

Not if the branch is set to prevent uncommit and push --overwrite, which
many trunk branches are. Also after pushing some environments trigger
large tasks like CI test runs, so uncommitting isn't enough to undo
whatever they did.

> > As a workaround you should be able to do 'bzr push
> --remember :parent'.
> >
> Yes, but bzr is just being annoying ;)
>
> bzr papercut! :D

I can see that it is annoying you, that doesn't mean that its the wrong
behaviour.

Can I ask, if you want to change that branch, why you aren't doing a
'bzr checkout' of it instead?

-Rob

On Wed, 2010-03-17 at 02:31 +0000, Robert Collins wrote:

> On Wed, 2010-03-17 at 02:02 +0000, Scott James Remnant wrote:
> >
> > If they can write to the branch, why would it be unsafe? If they
> > didn't
> > mean to push there, they wouldn't have typed "push" unguarded
>
> They might not know that bzr would push to that branch; they might have
> thought they had set an explicit target and hadn't.
>
That very same argument could be used to declare "checkout" dangerous.

"explicit target" sounds like the kind of thing that most non-bzr
developers don't know anything about

> Can I ask, if you want to change that branch, why you aren't doing a
> 'bzr checkout' of it instead?
>
Because I don't necessarily want every commit to go untested - I want to
have the opportunity to work on the package, test, build and only push
before I actually upload.

Scott
--
Scott James Remnant
<email address hidden>

On Wed, 2010-03-17 at 02:31 +0000, Robert Collins wrote:

> On Wed, 2010-03-17 at 02:02 +0000, Scott James Remnant wrote:
> >
> > If they can write to the branch, why would it be unsafe? If they
> > didn't
> > mean to push there, they wouldn't have typed "push" unguarded
>
> They might not know that bzr would push to that branch; they might have
> thought they had set an explicit target and hadn't.
>
More to the point - this is an argument against supporting implicit
targets at all!

How would a user, typing bzr push, know that it would push to the branch
they last pushed to?

Or worse, how do they know it *won't* push to the branch that they last
pushed to - and instead pushes to the branch they _first_ pushed to?

Scott
--
Scott James Remnant
<email address hidden>

Jelmer Vernooij (jelmer) on 2011-08-05
tags: added: easy
tags: removed: easy
Jelmer Vernooij (jelmer) on 2017-11-09
tags: added: check-for-breezy
Jelmer Vernooij (jelmer) on 2018-11-16
tags: added: location-ui
removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers