Fixing commit author with broken character encoding

Steve - Gadget Barnes GadgetSteve at hotmail.com
Sun May 5 07:52:59 UTC 2019


Where did my formatting go? Should have been (Trying with double <cr>s):


1. Run python3 -mpip install -u python-hglib 

2. Change directory to the one containing your checked out repo

3. run python3 

4. Run the following in the python session 

Import hglib client = hglib.open() 

log = client.log() # This will give you the entire history 

authors = {l.author for l in log} # This will give you the set of authors (as binary objects with no encoding).

Authors # Will print out the set of authors select the odd one and copy it 

Dodgy = [l.rev for l in log if l.author == b'pasted in strange one'

Dodgy # will print out the revs in question 

# exit when ready 

You can then use hg histedit (https://www.mercurial-scm.org/wiki/HisteditExtension) to resolve the problem locally (having made sure that all of your contributors are aware what is going) and hg push --force to overwrite the history.

-----Original Message-----
From: Mercurial <mercurial-bounces at mercurial-scm.org> On Behalf Of Steve - Gadget Barnes
Sent: 04 May 2019 08:02
To: Gregor Mückl <gmueckl at gregor-mueckl.de>; mercurial at mercurial-scm.org
Subject: RE: Fixing commit author with broken character encoding

Gregor,

If you have python3 installed you can:

1. Run python3 -mpip install -u python-hglib 2. Change directory to the one containing your checked out repo 3. run python3 4. Run the following in the python session Import hglib client = hglib.open() log = client.log() # This will give you the entire history authors = {l.author for l in log} # This will give you the set of authors (as binary objects with no encoding).
Authors # Will print out the set of authors select the odd one and copy it Dodgy = [l.rev for l in log if l.author == b'pasted in strange one'
Dodgy # will print out the revs in question # exit when ready You can then use hg histedit (https://www.mercurial-scm.org/wiki/HisteditExtension) to resolve the problem locally (having made sure that all of your contributors are aware what is going) and hg push --force to overwrite the history.

Hope that is some help.

Steve

-----Original Message-----
From: Mercurial <mercurial-bounces at mercurial-scm.org> On Behalf Of Gregor Mückl
Sent: 02 May 2019 15:03
To: mercurial at mercurial-scm.org
Subject: Fixing commit author with broken character encoding

Hi!

I have a repository with a commit that I apparently made with a misconfigured mercurial instance. Specificially, my author string seems to have been broken so that my last name was mangled into something that seems to be utterly broken. I can't tell you what the string in the commit looks like because I cannot reconstruct how different clients try to convert it before displaying it...

So, whatever I try to match that particular author name in an authormap file for hg convert, I can't get it to match because I don't know (a) what the actually stored internal string looks like and (b) how to reconstruct it so that hg can match it.

Is there a way to get hg convert to do a fuzzy match or pattern match for author names? Is there at least a way to get hg to dump the log or anything else containing the raw author string *without* any potential encoding conversion?

Regards
Gregor Mückl

_______________________________________________
Mercurial mailing list
Mercurial at mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial
_______________________________________________
Mercurial mailing list
Mercurial at mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial


More information about the Mercurial mailing list