{"thread":{"id":"36617","subject":"[PATCH] svn-fe: Conform to pep8","startedAt":"2014-05-09T02:36:50Z","lastAt":"2014-05-09T03:03:53Z","messageCount":3,"participants":["William Giokas","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"241094","messageId":"1399603010-2429-1-git-send-email-1007380@gmail.com","threadId":"36617","inReplyTo":null,"subject":"[PATCH] svn-fe: Conform to pep8","fromName":"William Giokas","fromEmail":"1007380@gmail.com","sentAt":"2014-05-09T02:36:50Z","receivedAt":"2014-05-09T02:36:50Z","isPatch":true,"sender":{"key":"1007380@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1731430?v=4"},"body":"Quite a large change, most of this was whitespace changes, though there\nwere a few places where I removed a comma or added a few characters.\nShould pass through pep8 and pass every test.\n---\n contrib/svn-fe/svnrdump_sim.py | 93 +++++++++++++++++++++++-------------------\n 1 file changed, 52 insertions(+), 41 deletions(-)\n\ndiff --git a/contrib/svn-fe/svnrdump_sim.py b/contrib/svn-fe/svnrdump_sim.py\nindex 4e78a1c..11ac6f6 100755\n--- a/contrib/svn-fe/svnrdump_sim.py\n+++ b/contrib/svn-fe/svnrdump_sim.py\n@@ -5,53 +5,64 @@ of the specified revision range.\n To simulate incremental imports the environment variable SVNRMAX can be set\n to the highest revision that should be available.\n \"\"\"\n-import sys, os\n+import sys\n+import os\n \n if sys.hexversion < 0x02040000:\n-        # The limiter is the ValueError() calls. This may be too conservative\n-        sys.stderr.write(\"svnrdump-sim.py: requires Python 2.4 or later.\\n\")\n-        sys.exit(1)\n+    # The limiter is the ValueError() calls. This may be too conservative\n+    sys.stderr.write(\"svnrdump-sim.py: requires Python 2.4 or later.\\n\")\n+    sys.exit(1)\n+\n \n def getrevlimit():\n-        var = 'SVNRMAX'\n-        if var in os.environ:\n-                return os.environ[var]\n-        return None\n+    var = 'SVNRMAX'\n+    if var in os.environ:\n+        return os.environ[var]\n+    return None\n+\n \n def writedump(url, lower, upper):\n-        if url.startswith('sim://'):\n-                filename = url[6:]\n-                if filename[-1] == '/': filename = filename[:-1] #remove terminating slash\n-        else:\n-                raise ValueError('sim:// url required')\n-        f = open(filename, 'r');\n-        state = 'header'\n-        wroterev = False\n-        while(True):\n-                l = f.readline()\n-                if l == '': break\n-                if state == 'header' and l.startswith('Revision-number: '):\n-                        state = 'prefix'\n-                if state == 'prefix' and l == 'Revision-number: %s\\n' % lower:\n-                        state = 'selection'\n-                if not upper == 'HEAD' and state == 'selection' and l == 'Revision-number: %s\\n' % upper:\n-                        break;\n+    if url.startswith('sim://'):\n+        filename = url[6:]\n+        if filename[-1] == '/':\n+            filename = filename[:-1]  # remove terminating slash\n+    else:\n+        raise ValueError('sim:// url required')\n+    f = open(filename, 'r')\n+    state = 'header'\n+    wroterev = False\n+    while(True):\n+        l = f.readline()\n+        if l == '':\n+            break\n+        if state == 'header' and l.startswith('Revision-number: '):\n+            state = 'prefix'\n+        if state == 'prefix' and l == 'Revision-number: %s\\n' % lower:\n+            state = 'selection'\n+        if not upper == 'HEAD' and state == 'selection' and \\\n+                l == 'Revision-number: %s\\n' % upper:\n+            break\n \n-                if state == 'header' or state == 'selection':\n-                        if state == 'selection': wroterev = True\n-                        sys.stdout.write(l)\n-        return wroterev\n+        if state == 'header' or state == 'selection':\n+            if state == 'selection':\n+                wroterev = True\n+            sys.stdout.write(l)\n+    return wroterev\n \n if __name__ == \"__main__\":\n-        if not (len(sys.argv) in (3, 4, 5)):\n-                print(\"usage: %s dump URL -rLOWER:UPPER\")\n-                sys.exit(1)\n-        if not sys.argv[1] == 'dump': raise NotImplementedError('only \"dump\" is suppported.')\n-        url = sys.argv[2]\n-        r = ('0', 'HEAD')\n-        if len(sys.argv) == 4 and sys.argv[3][0:2] == '-r':\n-                r = sys.argv[3][2:].lstrip().split(':')\n-        if not getrevlimit() is None: r[1] = getrevlimit()\n-        if writedump(url, r[0], r[1]): ret = 0\n-        else: ret = 1\n-        sys.exit(ret)\n+    if not (len(sys.argv) in (3, 4, 5)):\n+        print(\"usage: %s dump URL -rLOWER:UPPER\")\n+        sys.exit(1)\n+    if not sys.argv[1] == 'dump':\n+        raise NotImplementedError('only \"dump\" is suppported.')\n+    url = sys.argv[2]\n+    r = ('0', 'HEAD')\n+    if len(sys.argv) == 4 and sys.argv[3][0:2] == '-r':\n+        r = sys.argv[3][2:].lstrip().split(':')\n+    if not getrevlimit() is None:\n+        r[1] = getrevlimit()\n+    if writedump(url, r[0], r[1]):\n+        ret = 0\n+    else:\n+        ret = 1\n+    sys.exit(ret)\n-- \n2.0.0.rc2\n"},{"id":"241095","messageId":"20140509024632.GI9218@google.com","threadId":"36617","inReplyTo":"1399603010-2429-1-git-send-email-1007380@gmail.com","subject":"Re: [PATCH] svn-fe: Conform to pep8","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-05-09T02:46:33Z","receivedAt":"2014-05-09T02:46:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nWilliam Giokas wrote:\n\n> Quite a large change, most of this was whitespace changes, though there\n> were a few places where I removed a comma or added a few characters.\n> Should pass through pep8 and pass every test.\n\nThanks!  Mind if I forge your sign-off?  (See\nDocumentation/SubmittingPatches section (5) \"Sign your work\" for what\nthis means.)\n\nJonathan\n"},{"id":"241096","messageId":"20140509030353.GC550@wst420","threadId":"36617","inReplyTo":"20140509024632.GI9218@google.com","subject":"Re: [PATCH] svn-fe: Conform to pep8","fromName":"William Giokas","fromEmail":"1007380@gmail.com","sentAt":"2014-05-09T03:03:53Z","receivedAt":"2014-05-09T03:03:53Z","isPatch":true,"sender":{"key":"1007380@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1731430?v=4"},"body":"On Thu, May 08, 2014 at 07:46:33PM -0700, Jonathan Nieder wrote:\n> Hi,\n> \n> William Giokas wrote:\n> \n> > Quite a large change, most of this was whitespace changes, though there\n> > were a few places where I removed a comma or added a few characters.\n> > Should pass through pep8 and pass every test.\n> \n> Thanks!  Mind if I forge your sign-off?  (See\n> Documentation/SubmittingPatches section (5) \"Sign your work\" for what\n> this means.)\n\nOops. Feel free to put that in there. Most projects that I work on don't\nrequire that and I've gotten in the habbit of not using it.\n\n\nThanks,\n-- \nWilliam Giokas | KaiSforza | http://kaictl.net/\nGnuPG Key: 0x73CD09CF\nFingerprint: F73F 50EF BBE2 9846 8306  E6B8 6902 06D8 73CD 09CF\n"}]}