1

I have a remote repo cloned in my local computer.

After I make changes to a file, I commit, and then I do this to create a patch:

hg diff -U 8 -p -r PREVIOUS_REVISION_NUMBER file_name > patch_file

I send that patch_file for review.

But I don't see my name or email appearing anywhere in the patch.

My hgrc looks like this :

[ui]
username = My Name <[email protected]>

[extensions]
mq =

[diff]
git = 1
unified = 8
  1. Shouldn't I be seeing my name and email appearing in the patch? I want further changesets of the remote repo to have my name for this commit, if it does get pushed.

  2. Is there a better way of creating a patch, given my workflow? (make changes, commit, create patch)

EDIT : I asked because I saw in other people's patches :

# HG changeset patch
# Parent some_long_code
# User name <email>
# Date ....

2 Answers 2

1

Don't use hg diff to generate the patch. Use hg export which will add the information that you are expecting as a header at the top of the file including the user and commit message.

Use hg help export for more information.

2
  • Thanks. But I need to export only a few files. I sometimes work on 2 patches at the same time. So, I'll have changes in both sets of files. How do I export only a set of files?
    – batman
    Mar 8, 2013 at 18:11
  • Mercurial doesn't work with files, it works with changesets so you can't do that. Your best bet would probably be to use the mercurial queues extension to split the commits into smaller commits containing just the files you want and then export them. You might want to examine that extension to see if it can be used to improve your workflow. It's all about working with patches.
    – Steve Kaye
    Mar 8, 2013 at 21:05
0

Shouldn't I be seeing my name and email appearing in the patch?

I don't see why. The patch is a document describing the difference between two files. Your personal identity is not relevant to that difference.

6
  • How then will my patch, when pushed, tell the remote repo that it is my commit? I've seen names of individuals who committed in all open source projects.
    – batman
    Mar 7, 2013 at 10:42
  • @learner The identity of the pusher is metainformation. It is separate from the data content of the push. I do not actually know much about Mercurial specifically but this is how every VCS that I'm aware of works. In much the same way, the date/time of the push isn't part of your patch either. Mar 7, 2013 at 10:50
  • Oh. So my info would still be reaching them?
    – batman
    Mar 7, 2013 at 10:53
  • @learner I don't see why not! Don't you have to log in, or something? A version control system with built-in total anonymity would be kind of silly. Mar 7, 2013 at 10:56
  • The only place where I log in is into their bug tracking site. So, yes they know it is I who is giving it. But if an admin takes my patch, patches it, and commits it, I didn't seem to figure how my info would reach the main repo. (Maybe it is the meta-data like you said (?)) Also, would you please see my edit?
    – batman
    Mar 7, 2013 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.