This is an archive of the discontinued Mercurial Phabricator instance.

Fix hgext/convert/p4.py for Python 3
ClosedPublic

Authored by nate on May 9 2021, 6:03 PM.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nate created this revision.May 9 2021, 6:03 PM
mharbison72 requested changes to this revision.May 9 2021, 8:34 PM
mharbison72 added a subscriber: mharbison72.

The rest looks good, and this should be an easy fix for stable. Please take a look at the submission guidelines about the commit message when you amend the content:

https://www.mercurial-scm.org/wiki/ContributingChanges#Patch_descriptions

b/hgext/convert/p4.py
189 ↗(On Diff #27770)

I'm pretty sure this repr() is wrong. It looks like shortdesc is always bytes, and running that through repr() yields something like b'test'. Are you able to execute this code and view the results? Can you drop the repr() (and the encode()) and see if it works correctly?

This revision now requires changes to proceed.May 9 2021, 8:34 PM
nate updated this revision to Diff 27771.May 9 2021, 8:55 PM

Corrected. That works just as well.

I couldn't recall how to embed a message along with a patch. message+patch file concatenation? Not sure what topic and other fields/tags I should fill. Not to sound abrasive: I don't really have the time among millions of lines of code.

Given "Patch descriptions should be aimed at helping the reviewer understand the issue you're addressing.", I hope my title was descriptive enough. The best I can think is "dict.keys() doesn't have a sort method in python 3".

In D10703#162603, @nate wrote:

Corrected. That works just as well.
I couldn't recall how to embed a message along with a patch. message+patch file concatenation?

Typically, you just commit and put everything in the commit message, and then hg phabsend .

It's not letting me import this patch for some reason, complaining about "failing to synchronize the metadata". How did you create this differential? Since it's trivial, I can just fix it up for you, but do you have a name and email address to apply to this?

Not sure what topic and other fields/tags I should fill. Not to sound abrasive: I don't really have the time among millions of lines of code.
Given "Patch descriptions should be aimed at helping the reviewer understand the issue you're addressing.", I hope my title was descriptive enough. The best I can think is "dict.keys() doesn't have a sort method in python 3".

Don't worry about this, I'll adjust it. I only pointed it out because the automated tests will complain if the first line isn't in the proper "topic: lowercase words..." format, and the guidelines probably aren't easy enough for new contributors to find. Let me know what name/email to apply, and I'll land this for you.

nate added a comment.May 9 2021, 11:45 PM

Thanks for the info.

I created the diff outside of hg (on direct source archives); mostly diff -ur a b... [hg] patch -p1 should make it apply (maybe -u for unified or the equivalent hg option).

I appreciate your follow through getting this in.

nate.skulic@gmail.com

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.
In D10703#162605, @nate wrote:

Thanks for the info.
I created the diff outside of hg (on direct source archives); mostly diff -ur a b... [hg] patch -p1 should make it apply (maybe -u for unified or the equivalent hg option).

The problem turned out to be this line in the diff with an extra a/ and b/:

diff --git a/a/hgext/convert/p4.py b/b/hgext/convert/p4.py

No big deal, sed was able to fix it.

I appreciate your follow through getting this in.

Thanks for the patch, it should be in the next point release. Since you're messing with p4 stuff, do you happen to use the perfarce extension? I was thinking about removing support from TortoiseHg since I don't see a modern version of it, and assumed nobody uses it anymore.

nate added a comment.May 10 2021, 12:57 AM

Not sure what happened to the original author (Frank) --- though, I think he's out of it.

Perfarce is definitely used. Updating and fixing it (for python 3) as we speak. Mostly ready to go. An update shall be posted (sometime this week); probably to https://github.com/rghe/perfarce