Bug 4296 - histedit does not preserve authorship when folding
Summary: histedit does not preserve authorship when folding
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: histedit (show other bugs)
Version: 3.0.2
Hardware: PC Mac OS
: normal bug
Assignee: Martin von Zweigbergk
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2014-07-05 01:06 UTC by Bryan O'Sullivan
Modified: 2014-09-04 13:48 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments
iceland.hg (1.44 KB, application/octet-stream)
2014-07-05 01:06 UTC, Bryan O'Sullivan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan O'Sullivan 2014-07-05 01:06 UTC
Created attachment 1777 [details]
iceland.hg

If I use histedit's fold capability to merge changesets, the new changeset that it creates lists me as the author, losing the authorship of the base commit that a change is being folded into.

I'm having a hard time reproducing this in a small test repo, so I'll add a repro that I know works in a minute.
Comment 1 Bryan O'Sullivan 2014-07-05 01:16 UTC
Repro:

hg clone -r 20cbbab58e51 https://bitbucket.org/bos/text bug4296
curl curl http://bug4296.bz.selenic.com/attachment.cgi?id=1777 > bug4296.hg

cat > bug4296.histedit <<EOF
pick edf96f1147fa
fold 202c1188e5ad
fold df6d16ea4341
EOF

cd bug4296
hg unbundle ../bug4296.hg
hg update tip

hg histedit edf96f1147fa --commands ../bug4296.histedit



Once you're dropped into the editor for the first edited commit, you'll notice that the author has changed from baldurpet@gmail.com to you.
Comment 2 Augie Fackler 2014-07-08 21:58 UTC
Interesting. When you observe this behavior, do the two patches not have the same author?

I think there's explicit logic right now to keep the original author if the folded-together changes have the same author, otherwise to use ui.author. Does that feel wrong? I didn't put significant thought into the current behavior, I just had to pick something at the time, so a change might be welcome if there's any measure of consensus about the sensible behavior.

If anyone knows what 'git rebase --interactive' does in this case, that might be useful as a datapoint as well.

(I can see a fairly strong argument for keeping the author of the oldest change in the fold set. I suspect that's what you expected?)
Comment 3 Bryan O'Sullivan 2014-07-09 05:36 UTC
The author of the commits I'm amending has the same email for each commit, but not the same name. I think that preserving the first author makes sense – it's certainly what I actually expected to happen :-)
Comment 4 HG Bot 2014-08-14 16:30 UTC
Fixed by http://selenic.com/repo/hg/rev/9ac98c2aa95c
Martin von Zweigbergk <martinvonz@gmail.com>
histedit: preserve initial author on fold (issue4296)

When the authorship of the changeset folded in does not match that of
the base changeset, we currently use the configured ui.username
instead. This is especially surprising when the user is not the author
of either of the changesets. In such cases, the resulting authorship
(the user's) is clearly incorrect. Even when the user is folding in a
patch they authored themselves, it's not clear whether they should
take over the authorship. Let's instead keep it simple and always
preserve the base changeset's authorship. This is also how
"git rebase -i" handles folding/squashing.

(please test the fix)