* [PATCH] git-p4: Avoid modules deprecated in Python 2.6.
@ 2009-08-26 16:52 Reilly Grant
2009-08-26 18:14 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Reilly Grant @ 2009-08-26 16:52 UTC (permalink / raw)
To: git, gitster; +Cc: Reilly Grant
The popen2, sha and sets modules are deprecated in Python 2.6 (sha in
Python 2.5). Both popen2 and sha are not actually used in git-p4.
Replace usage of sets.Set with the builtin set object.
Signed-off-by: Reilly Grant <reillyeon@qotw.net>
---
contrib/fast-import/git-p4 | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 342529d..ca58700 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -8,12 +8,10 @@
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
#
-import optparse, sys, os, marshal, popen2, subprocess, shelve
-import tempfile, getopt, sha, os.path, time, platform
+import optparse, sys, os, marshal, subprocess, shelve
+import tempfile, getopt, os.path, time, platform
import re
-from sets import Set;
-
verbose = False
@@ -861,8 +859,8 @@ class P4Sync(Command):
self.usage += " //depot/path[@revRange]"
self.silent = False
- self.createdBranches = Set()
- self.committedChanges = Set()
+ self.createdBranches = set()
+ self.committedChanges = set()
self.branch = ""
self.detectBranches = False
self.detectLabels = False
@@ -1627,7 +1625,7 @@ class P4Sync(Command):
if len(self.changesFile) > 0:
output = open(self.changesFile).readlines()
- changeSet = Set()
+ changeSet = set()
for line in output:
changeSet.add(int(line))
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] git-p4: Avoid modules deprecated in Python 2.6.
2009-08-26 16:52 [PATCH] git-p4: Avoid modules deprecated in Python 2.6 Reilly Grant
@ 2009-08-26 18:14 ` Junio C Hamano
2009-08-26 18:39 ` Reilly Grant
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-08-26 18:14 UTC (permalink / raw)
To: Reilly Grant; +Cc: git
Reilly Grant <reillyeon@qotw.net> writes:
> The popen2, sha and sets modules are deprecated in Python 2.6 (sha in
> Python 2.5). Both popen2 and sha are not actually used in git-p4.
> Replace usage of sets.Set with the builtin set object.
Does the code already rely on a feature not found in Python older than 2.4
before your patch? Otherwise I would have liked to see the last sentence
like this:
Replace usage of sets.Set with the builtin set object, which has
been available since Python 2.4.
This change makes the script unusable with Python older than 2.4,
which was released in 2004. Hopefully nobody uses ancient 2.3.
So that I did not have to check myself to get a feel of how safe this
change is.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] git-p4: Avoid modules deprecated in Python 2.6.
2009-08-26 18:14 ` Junio C Hamano
@ 2009-08-26 18:39 ` Reilly Grant
0 siblings, 0 replies; 3+ messages in thread
From: Reilly Grant @ 2009-08-26 18:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Reilly Grant <reillyeon@qotw.net> writes:
>
>
>> The popen2, sha and sets modules are deprecated in Python 2.6 (sha in
>> Python 2.5). Both popen2 and sha are not actually used in git-p4.
>> Replace usage of sets.Set with the builtin set object.
>>
>
> Does the code already rely on a feature not found in Python older than 2.4
> before your patch? Otherwise I would have liked to see the last sentence
> like this:
>
> Replace usage of sets.Set with the builtin set object, which has
> been available since Python 2.4.
>
> This change makes the script unusable with Python older than 2.4,
> which was released in 2004. Hopefully nobody uses ancient 2.3.
>
> So that I did not have to check myself to get a feel of how safe this
> change is.
>
Thank you for the advice, this is my first patch. The existing code
uses the built-in set module in other places so the 2.4 requirement
already exists. I should have mentioned this in the original description.
--
Reilly Grant
reillyeon@qotw.net http://www.qotw.net/~reillyeon
GPG Key Signature: 2A41 A3E5 F3CA D3A0 F5CF 02DF B1EB CDEC 7850 E278
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-26 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-26 16:52 [PATCH] git-p4: Avoid modules deprecated in Python 2.6 Reilly Grant
2009-08-26 18:14 ` Junio C Hamano
2009-08-26 18:39 ` Reilly Grant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox