repo question - how to handle "branch is published (but not merged)"

5,853 views
Skip to first unread message

dpreilan

unread,
Mar 23, 2011, 8:23:09 AM3/23/11
to Repo and Gerrit Discussion
NOTE, I asked this question in the android building group as well, but
I think this is the right group.

Is there a way to get repo to allow me to reupload a branch?

It knows I uploaded a branch

repo sync is showing:
error: <xx>: branch <xx> is published (but not merged) and is now X
commits behind.

repo upload doesn't do anything because it knows I have already done
it.

I know I can just make a new commt and do another upload, but is there
a more graceful way.

Thanks

Mahesh Vaidya

unread,
Mar 23, 2011, 9:09:37 AM3/23/11
to Repo and Gerrit Discussion
I have faced this problem and here how I have solved

there are patch sets, where A <-  B (B depends on A)

A <- B <- C <- D and uploaded those 4 patchsets. If you have abandoned "B" you can't merge C and D due to dependency break.

Now you need to go to your workspace and do "git revert B" this create a patchset "E"
A <- B <- C <- D  <- E.

After this revive pathset "B" which you have abandoned and merge all A thru E where effect of "B" is already canceled by "E"

Thank You

-Mahesh Vaidya.




--
Thank you and best regards.
Mahesh Vaidya  / 9740500144
http://www.twitter.com/forvaidya

Magnus Bäck

unread,
Mar 23, 2011, 12:17:41 PM3/23/11
to Repo and Gerrit Discussion
On Wednesday, March 23, 2011 at 14:09 CET,
Mahesh Vaidya <forv...@gmail.com> wrote:

> I have faced this problem and here how I have solved
>
> there are patch sets, where A <- B (B depends on A)
>
> A <- B <- C <- D and uploaded those 4 patchsets. If you have abandoned
> "B" you can't merge C and D due to dependency break.
>
> Now you need to go to your workspace and do "git revert B" this create
> a patchset "E"
> A <- B <- C <- D <- E.
>
> After this revive pathset "B" which you have abandoned and merge all A
> thru E where effect of "B" is already canceled by "E"

This isn't necessarily the same problem that the OP is having. That
said, there is a better way of doing what you want; do an interactive
rebase and remove commit B:

git rebase --interactive A
(Delete the first line of the text file shown to you, exit editor.)

This leaves you with the following commit tree:

A <- C <- D

Uploading will leave change A intact but will upload new patch sets
for changes C and D, where change C won't depend on B anymore.

--
Magnus B�ck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson

Magnus Bäck

unread,
Mar 23, 2011, 12:21:13 PM3/23/11
to Repo and Gerrit Discussion
On Wednesday, March 23, 2011 at 13:23 CET,
dpreilan <drei...@gmail.com> wrote:

> NOTE, I asked this question in the android building group as well, but
> I think this is the right group.

Yes, it is.

> Is there a way to get repo to allow me to reupload a branch?
>
> It knows I uploaded a branch
>
> repo sync is showing:
> error: <xx>: branch <xx> is published (but not merged) and is now X
> commits behind.
>
> repo upload doesn't do anything because it knows I have already done
> it.

Indeed, because there's no point in uploading anything unless you've
actually made changes. Running "repo sync" will only rebase a topic
branch that hasn't been uploaded (published).

> I know I can just make a new commt and do another upload, but is there
> a more graceful way.

Rebase your branch.

git rebase origin/name-of-upstream-branch

Shawn Pearce

unread,
Apr 7, 2011, 9:27:25 PM4/7/11
to Repo and Gerrit Discussion

On Mar 23, 2011 12:22 PM, "Magnus Bäck" <magnu...@sonyericsson.com> wrote:
> Rebase your branch.
>
> git rebase origin/name-of-upstream-branch

Or use `repo rebase` as it knows what the upstream branch is from the manifest.

Nick Sanders

unread,
May 6, 2011, 4:25:55 PM5/6/11
to Repo and Gerrit Discussion, m...@chromium.org


On Apr 7, 6:27 pm, Shawn Pearce <s...@google.com> wrote:
> On Mar 23, 2011 12:22 PM, "Magnus Bäck" <magnus.b...@sonyericsson.com>
> wrote:
>
> > Rebase your branch.
>
> > git rebase origin/name-of-upstream-branch
>
> Or use `repo rebase` as it knows what the upstream branch is from the
> manifest.


> Indeed, because there's no point in uploading anything unless you've
> actually made changes. Running "repo sync" will only rebase a topic
> branch that hasn't been uploaded (published).

Is there a way to configure repo to rebase all branches whether
they've been
published or not? I work on chromiumos, and we've recently switched to
gerrit,
and we often have outstanding published changes that need to be
rebased frequently..

Thanks,
-Nick

Trevor Bourget

unread,
May 7, 2011, 1:56:06 AM5/7/11
to Repo and Gerrit Discussion, Nick Sanders, m...@chromium.org
See manual page
<http://www.kernel.org/pub/software/scm/git/docs/git-pull.html> for how to
use git config to have rebase on pull be automatic.
-- trevor

On Fri, 06 May 2011 13:25:55 -0700, Nick Sanders <nsan...@google.com>
wrote:

--
Sent by an employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum.

Reply all
Reply to author
Forward
0 new messages