This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add Mercurial support to patchcheck
Type: enhancement Stage: patch review
Components: Demos and Tools Versions: Python 3.3, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, brett.cannon, eric.araujo, georg.brandl, mark.dickinson, pitrou
Priority: low Keywords: needs review, patch

Created on 2010-06-15 09:19 by eric.araujo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
hg-support.diff eric.araujo, 2010-06-22 20:21 use hg st or svn st according to the type of the checkout/clone
Messages (13)
msg107858 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-15 09:19
I got bored of manually changing the svn status command to hg status when testing my patch for #8912, so I made a proper patch once and for all. (Did I already say yay for Mercurial Queues?)
msg107866 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-15 11:24
Adding nosy from the other patchcheck bug, hope it doesn’t annoy anyone.
msg108364 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-22 10:56
In the absence of formal testing, a few comments on my patch to help
reviewers.

1) If the code is both an svn and hg checkout, hg wins, since it’s not unheard of to use hg on top of svn, whereas the contrary does not make sense to me.

2) The hg status command does not need post-processing like the svn one, since hg status --added --modified will already filter the output, and --no-status means “don’t print A or M at the start of each line”.

3) I changed a list comp for a genexp, and used startswith instead of getitem+contains+eq; does not change behavior.

4) I suppressed the unneeded shell=True argument to subprocess.Popen (and made the command string into a list); does not change behavior since there were no globbing or path expansion of any kind.

Testing is easy: Apply the patch, add bad indentation in a Python file, run make patchcheck (./python Tools/scripts/patchcheck.py on OSes without make), profit.
msg108388 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-06-22 14:42
A small suggestion: rather than having bool hg which means Mercurial if true and SVN if false, consider a string valued vc variable with 'svn' for  SVN and 'hg' for Mercurial.  This way it will be straightforward to add support for other VC systems in the future.
msg108414 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-22 20:21
Updated. I also changed two sets to lists, to retain usage. I’m sure that Mercurial won’t print the same filename twice, and I’m nearly sure Subversion won’t either. Retaining order will make the report a bit more readable.
msg108415 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-22 20:21
s/usage/order/ *sigh*
msg108455 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-06-23 14:48
The purpose of patchcheck.py is not obvious to me. If it's meant to be used by committers (rather than contributors), than we should wait for the actual hg migration and the definition of our new workflow. Also, we might "need" two separate scripts: one for individual changesets and one for pushes.

("need" is in quotes because I'm not sure anyone actually uses patchcheck.py)
msg108461 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-06-23 17:05
So patchcheck is meant for both contributors and committers. I originally wrote it for me, but it helps make sure the patch is in a reasonable state before someone submits a patch.

As for Hg support, enough people seem to run mq on top of svn to make this a reasonable thing to add now and to change once the transition occurs.
msg108477 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-06-23 19:23
> As for Hg support, enough people seem to run mq on top of svn to make
> this a reasonable thing to add now and to change once the transition
> occurs.

Yes, but the question is what workflow it should assume. If you are
running mq for example (or pbranch, or doing local named branches),
using a simple "hg status" of the working copy will not do the right
thing.

(and, by the way, you can't assume mq is the favourite workflow out of
there: I for example use clones + local named branches instead)
msg108480 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-06-23 19:27
Good point, Antoine. Then I might leave this patch for now and come back to it when we do the Hg transition.
msg109255 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-04 19:00
> [...] using a simple "hg status" of the working copy will not do the right thing

I think all of these workflows share a step where you have edits in your working directory that are not in the working dir’s parent changeset. Thus, I argue that hg status is helpful in a majority of cases.

In the long term, it may be better to make patchcheck work on diffs rather than $vcs status (that will be an interesting challenge for me), or something else depending on the future dev policy. That is explicitly what I’m not doing here: I’m doing a straightforward patch to add support for Mercurial in a way that just mimics Subversion, doesn’t mandate one workflow, and doesn’t cost anything.

Now it’s up to you to commit this or set resolution to “later”, I won’t argue further or complain. :)
msg119282 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-10-21 12:49
Applied in r85767.
msg119321 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 17:23
Great, thanks!
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53245
2010-10-21 17:23:03eric.araujosetmessages: + msg119321
2010-10-21 12:49:58georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg119282

resolution: accepted
2010-07-04 19:00:47eric.araujosetmessages: + msg109255
2010-06-23 19:27:46brett.cannonsetassignee: brett.cannon ->
messages: + msg108480
2010-06-23 19:23:28pitrousetmessages: + msg108477
2010-06-23 17:05:51brett.cannonsetassignee: brett.cannon
messages: + msg108461
2010-06-23 14:48:21pitrousetmessages: + msg108455
2010-06-22 20:21:53eric.araujosetmessages: + msg108415
2010-06-22 20:21:16eric.araujosetfiles: + hg-support.diff

messages: + msg108414
2010-06-22 20:19:20eric.araujosetfiles: - hg-support.diff
2010-06-22 14:42:48belopolskysetmessages: + msg108388
2010-06-22 10:57:40eric.araujosetkeywords: + needs review
2010-06-22 10:56:27eric.araujosetmessages: + msg108364
2010-06-15 11:24:20eric.araujosetnosy: + brett.cannon, mark.dickinson, belopolsky, pitrou
messages: + msg107866
2010-06-15 09:19:31eric.araujocreate