Fixing my branches

Bryan Murdock bmurdock at gmail.com
Thu Mar 3 20:03:06 UTC 2016


On Thu, Mar 3, 2016 at 12:32 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 3 March 2016 at 19:04, Bryan Murdock <bmurdock at gmail.com> wrote:
>> On Thu, Mar 3, 2016 at 11:01 AM, Brandon McCaig <bamccaig at gmail.com> wrote:
>>> Paul:
>>>
>>> On Thu, Mar 03, 2016 at 04:42:35PM +0000, Paul Moore wrote:
>>>> Hi,
>>>
>>> What I've done is abandoned bookmarks and use evolve locally to
>>> manage named branches. I just hold off pushing until I'm
>>> relatively satisfied, deal with mistakes that are public, and
>>> settle for permanent history (I have over 600 branches listed by
>>> hg branches because maintaining closed branches is that much more
>>> error-prone meatstuff work that just doesn't happen
>>> consistently).
>>
>> That's what I do, except I don't bother naming branches at all. Mercurial
>> will keep track of your commits just fine, no named branch or bookmark need.
>
> But how do I then go back to "where upstream is" to start a new PR
> based off upstream? If I just edit what's at my tip revision, my new
> PR gets included in my existing one.
>
> History is basically
>
> .... -> * Where I forked upstream -> Changesets for my PR 1
>
> To create PR 2, I want to go back to the point marked *. But Mercurial
> has no name for that point, as far as I know, so I have to go and look
> at the upstream repo, find the changeset ID of the last commit there,
> and then do "hg up -r <changeset_id>".
>
> I may well be missing a built in name for "the last changeset pulled
> from upstream". That's sort of my point :-)

You don't have to go look at the upstream repo.  hg outgoing will show
you your local commits.  The parent of the oldest of those local
commits will be the one you have called *.  What I actually do is
this:

hg log -G

That makes it easy to see where you started committing on top of * (*
will usually be a commit made by someone other than you).  Then:

hg up <rev of *>
# do new work
hg commit

If you still aren't sure where your line of PR commits started when
you look at hg log -G then run:

hg outgoing -r .

And then use the revision of the parent of the oldest commit there
(usually one less than the revision (not SHA, revision) of the oldest
commit).

Bryan



More information about the Mercurial mailing list