2

I am converting a CVS repository (actually a number of them) into a Mercurial setup, and was wondering if any one had experience with updating and correcting usernames in the changesets.

The issue is that over quite a long period of time a default user has been used fairly often to commit to the CVS repository, and the commit message has then been supplied with '(initials)' at the end to identify the actual person committing. And now that I am converting to Mercurial I would like to clean this up, by setting the correct username.

Having done some research this seems non-trivial and I was thinking that something along the lines of this:

  • convert to hg and tag/branch commits with a specific initial in the commit message, using --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
  • converting this new repository and then use the --authormap to edit the default user to the persons initials.

But I am unsure if it is possible to selectively convert out branches and then get it back into its original place in the history.

Any help or ideas would be greatly appreciated. I have of course fully control of all the repository clones since it is not published in any way.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
place
  • 73
  • 6

2 Answers2

0

The Convert extension sadly doesn't provide a convenient way to have conditional author mappings, but it does permit performing the conversion incrementally. You can then perform your conversion in small steps, inside of which a single author map is valid. You can use also script the generation of these "fence post" commits.

I had a similar problem today, where I wanted to conditionally change the username in some old commits in a Mercurial repository. I've bundled up all of my steps into a convenient script, which you can find here. The downside is that it depends on some Mercurial specific behavior, but you can work around this by first converting with a basic, non conditional author map, and then running the conditional conversion on the that repository.

This question is rather old, but if you don't have too many clones out in the wild, it may still be worth your while to run the author-name correcting conversion. Remember: hg convert necessarily changes the hash for every changeset, so you have to deal with all the usual issues of EditingHistory. I suspect this is part of the reason why both of the usual ways of dealing with this, Mercurial Queues and the newer HistEdit Extension, don't play nice with merge changesets -- it's difficult and messy to redo a non-leaf merge, and the presence of merges often indicates that you've shared the repository, which means you should reconsider editing history.

Livius
  • 3,240
  • 1
  • 17
  • 28
0

You need to use the Convert extension. You can follow the answer from this post.

Community
  • 1
  • 1
Lucian
  • 1,066
  • 7
  • 4
  • Thanks, but that will only allow me to change from one user name to another. I have a lot commits from the same user name, but I want to change some of these changesets from user def_user to inialsA and others to initialsB etc. based on some text in the commit message. – place Feb 28 '11 at 13:18