9

Bazaar support adding meta data to commit to record who the actual author of a change is vs. the person who commits the change:

  $ bzr commit --author "Jane Rey <jrey@example.com>" \
               --author "John Doe <jdoe@example.com>"

After adding this meta data it accessible via bzr log, like:

------------------------------------------------------------
revno: 105661
fixes bug(s): http://debbugs.gnu.org/9414
author: Oleksandr Gavenko 
committer: Juri Linkov 
branch nick: trunk
timestamp: Mon 2011-09-05 12:55:11 +0300
message:
  * lisp/progmodes/grep.el (rgrep): Add "-type d".

It is possible embed such metadata in commit for Mercurial/Git?

sylvanaar
  • 8,096
  • 37
  • 59
gavenkoa
  • 45,285
  • 19
  • 251
  • 303

3 Answers3

10

In git you have the similar command:

git commit --author="Name <name@example.com>"

But it usually comes from pre-set config values.

Hg has a similar flag for setting the user, but does not make a distinction between author and committer. But there is an extension to do that.

Both git and hg do not have the concept of setting multiple authors for a commit. Though that is usually done in the commit message in some pre-determined way / convention in the team

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • For Mercurial, I would recommend to just mention that person in the commit message. The meta-data added by that extension won’t be visible unless the viewer also has that extension installed, I think. – Laurens Holst Oct 24 '11 at 08:50
4

Mercurial has no such ability by default. There is no way to specify a "committer" vs an "author" directly. Similarly there is support for only one author.

sylvanaar
  • 8,096
  • 37
  • 59
  • You say that this is not possible by default. Is this mean that some external extension allow such thing? Do you know one? – gavenkoa Oct 22 '11 at 11:14
1

Such metadata is embedded by default in git. To see it just try tying git log. You'll see all the metadata associated with each commit. You can set your username and email as specified in this tutorial. Essentially you can set your email and name like this:

$ git config --global user.name "Scott Chacon"

$ git config --global user.email "schacon@gmail.com"

Also, git has a fun command called blame which lets you see who changed exactly what line.

Community
  • 1
  • 1
Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102
  • You provide info that I already know... I am looking for more advanced case there user can not directly commit but can sen patches. And I look to ability when regular developer apply patch to embed original author name to commit metadata. – gavenkoa Oct 22 '11 at 10:00
  • Sorry, but you never specified what you did and didn't know in your question. You should be more specific next time. – Kurtis Nusbaum Oct 22 '11 at 17:51
  • A suppose that this clean flow from context )) – gavenkoa Oct 22 '11 at 20:56