discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: piem@inbox.kyleam.com
Subject: Re: Applying the same patch multiple times
Date: Tue, 26 Apr 2022 23:49:07 -0400	[thread overview]
Message-ID: <8735hzi3t8.fsf@kyleam.com> (raw)
In-Reply-To: <8735i0urq7.fsf@localhost>

Ihor Radchenko writes:

> I also noticed one minor annoyance when I return to work on the
> previously applied patch.
> My starting point is the patch-containing email. Then, I run piem-am and
> use the default automatically generated branch.

Interesting, using the email as the staring point for jumping to a
branch isn't a use case that I've considered, but, yeah, I can see why
that's appealing.

> Expected behaviour: Silently switch to the already existing branch
> unless that branch had modifications to the patch in the email. In the
> latter case, either throw an error or show the changes interactively.

Hmm, this makes a strong assumption about the patch to branch name
mapping, but the branch name offered in the prompt is just a (hopefully
helpful) suggestion/starting point.

To implement this feature, I'm not seeing a way around needing to
maintain the mapping.  The first thing that comes to mind is that the
Git configuration for the branch could be a good place to keep it (say
branch.$branch.piem-mid).  That would allow generating the mid->branch
mapping for a coderepo and has the nice feature that it's cleaned up by
Git when the branch is deleted.  There are other wrinkles here, but I
think the overall approach would probably be workable.

> Observed behaviour: Because the branch already exists and the patch is
> already applied, git am throws an error.

Odd.  I expected the git-checkout call upstream of git-am to fail
(saying something like "fatal: a branch named 'blah' already exists").
Testing quickly, that's what I see on my end.

(Either way, that's of course not your desired behavior.)

> I think a more useful approach would be something like:
> 1. piem creates a throwaway branch and apply the patch in the email
> 2. piem rebases the existing branch onto that throwaway branch

I'm not quite connecting this (1)...

> That way, I can start working on a patch from email, possibly add some
> followup commits and still be able to return to this WIP branch starting
> from the patch email.

...to this (2).  2 more or less aligns with how I understood the rest of
your email, but I don't see where 1 comes in.  If you already applied a
patch from a particular message, that patch isn't changing, so wouldn't
you just want to jump to the associated branch, even if you amended the
given commit and/or added commits on top?

Perhaps the answer is that these are updated patches from later
messages.  I'd say those ought to land on a separate branch, though I
know that unfortunately some people aren't good about bumping the reroll
count of their patches, in which case the suggested branch name won't be

Thanks for your feedback.

  reply	other threads:[~2022-04-27  3:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24  7:48 [FR] Support multiple repositories associated with the same ML Ihor Radchenko
2022-04-24 22:12 ` Kyle Meyer
2022-04-26  9:19   ` Applying the same patch multiple times (was: [FR] Support multiple repositories associated with the same ML) Ihor Radchenko
2022-04-27  3:49     ` Kyle Meyer [this message]
2022-04-27 12:46       ` Applying the same patch multiple times Ihor Radchenko
2022-05-07 14:19         ` Kyle Meyer
2022-05-06  1:40   ` [PATCH] piem-inboxes: Support mapping inbox to multiple coderepos Kyle Meyer
2022-05-06  2:10     ` Ihor Radchenko
2022-05-06  3:28       ` Kyle Meyer
2022-05-07  5:21         ` Ihor Radchenko
2022-05-07 14:18           ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735hzi3t8.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    --cc=yantar92@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).