Editing an author for specific changesets

I am currently looking at a transition from subversion to Mercurial at work, and as such the Mercurial repository has not yet been published.

I used the authormap argument to convert our usernames to the Mercurial format, which went fine.

Unfortunately, two people commit the same name. The repository is not very large, so I would like to change the authors to fit the right people. For this reason, I would like to ask:

Is there a way to change the author for a specific set of changes or a list of sets of changes?

+6
source share
2 answers

You can use the added Mercurial Queues (MQ) extension to modify commit authors. Please note that MQ will only work as long as the story is linear. If there are branches, you need to first reinstall them in a temporary side branch, and then after editing, return them back.

The first qimport changes to the first set of changes you want to change:

 hg qinit hg qimport -g -r <first-revnr>:tip 

Then use qpop or qgoto to jump to the corresponding change sets:

 hg qgoto <revnr>.diff 

And then use qrefresh to change the user information in the currently active change set:

 hg qrefresh -u "Some User < user@example.com >" 

You can check with hg log whether the user has been updated correctly. After that, repeat for all other change sets.

When you are done, qpush all the patches and use qfinish to complete the repository.

 hg qpush -a hg qfinish -a 
+9
source

You can also use develop extension . After setting up the extension

 hg amend -U && hg prev 

for a stack of commits, and then hg evolve --all at the end.

Evolve presents a meta graph that says commit replaces commit. Therefore, when we do hg amend -U bunch of times, we create commits with another author who replaced the old commits. hg evolve --all replacement information will be used to find out where to move the commits that were based on our previously replaced commits.

Credits for mercury developers on IRC # mercurial.

+1
source

Source: https://habr.com/ru/post/907384/


All Articles