{"thread":{"id":"26197","subject":"patch for git-p4","startedAt":"2011-01-05T01:45:50Z","lastAt":"2011-01-06T00:46:49Z","messageCount":4,"participants":["Andrew Garber","Erik Faye-Lund","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"158934","messageId":"AANLkTi=sNsDy9oo0iBE-qJwvFSDMFYma3oYhbP1J-th=@mail.gmail.com","threadId":"26197","inReplyTo":null,"subject":"patch for git-p4","fromName":"Andrew Garber","fromEmail":"andrew@andrewgarber.com","sentAt":"2011-01-05T01:45:50Z","receivedAt":"2011-01-05T01:45:50Z","isPatch":false,"sender":{"key":"andrew@andrewgarber.com","avatar":"https://avatars.githubusercontent.com/u/265048?v=4"},"body":"Hi everyone! This is my first post to the git mailing list.\n\nI was reading the git-p4 source and noticed that some of the lines are\nindented using tabs instead of spaces (very bad in Python). Here's a\npatch against tag v1.7.4-rc0 (commit\n01b97a4cb60723d18b437efdc474503d2a9dd384) of the git source repo.\n\nThanks!\nAndrew Garber\n\n\nFrom ce7ff27529bb5ec608ba6b6a841ce2f3ce605a3c Mon Sep 17 00:00:00 2001\nFrom: Andrew Garber <andrew@andrewgarber.com>\nDate: Wed, 29 Dec 2010 00:23:05 -0800\nSubject: [PATCH] git-p4: replaced tabs with spaces\n\nSome the commits to git-p4 used tabs for indenting instead of spaces. I\nalso did some minor reformatting.\n---\n contrib/fast-import/git-p4 |   71 +++++++++++++++++++++-----------------------\n 1 files changed, 34 insertions(+), 37 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex 04ce7e3..449df2e 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -222,10 +222,10 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):\n     try:\n         while True:\n             entry = marshal.load(p4.stdout)\n-\t    if cb is not None:\n-\t\tcb(entry)\n-\t    else:\n-\t\tresult.append(entry)\n+            if cb is not None:\n+                cb(entry)\n+            else:\n+                result.append(entry)\n     except EOFError:\n         pass\n     exitCode = p4.wait()\n@@ -445,8 +445,8 @@ def p4ChangesForPaths(depotPaths, changeRange):\n \n     changes = {}\n     for line in output:\n-\tchangeNum = int(line.split(\" \")[1])\n-\tchanges[changeNum] = True\n+        changeNum = int(line.split(\" \")[1])\n+        changes[changeNum] = True\n \n     changelist = changes.keys()\n     changelist.sort()\n@@ -954,10 +954,9 @@ class P4Sync(Command):\n     # - helper for streamP4Files\n \n     def streamOneP4File(self, file, contents):\n-\tif file[\"type\"] == \"apple\":\n-\t    print \"\\nfile %s is a strange apple file that forks. Ignoring\" % \\\n-\t\tfile['depotFile']\n-\t    return\n+        if file[\"type\"] == \"apple\":\n+            print \"\\nfile %s is a strange apple file that forks. Ignoring\" % file['depotFile']\n+            return\n \n         relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)\n         if verbose:\n@@ -1004,23 +1003,22 @@ class P4Sync(Command):\n \n     # handle another chunk of streaming data\n     def streamP4FilesCb(self, marshalled):\n+        if marshalled.has_key('depotFile') and self.stream_have_file_info:\n+            # start of a new file - output the old one first\n+            self.streamOneP4File(self.stream_file, self.stream_contents)\n+            self.stream_file = {}\n+            self.stream_contents = []\n+            self.stream_have_file_info = False\n \n-\tif marshalled.has_key('depotFile') and self.stream_have_file_info:\n-\t    # start of a new file - output the old one first\n-\t    self.streamOneP4File(self.stream_file, self.stream_contents)\n-\t    self.stream_file = {}\n-\t    self.stream_contents = []\n-\t    self.stream_have_file_info = False\n-\n-\t# pick up the new file information... for the\n-\t# 'data' field we need to append to our array\n-\tfor k in marshalled.keys():\n-\t    if k == 'data':\n-\t\tself.stream_contents.append(marshalled['data'])\n-\t    else:\n-\t\tself.stream_file[k] = marshalled[k]\n+        # pick up the new file information... for the\n+        # 'data' field we need to append to our array\n+        for k in marshalled.keys():\n+            if k == 'data':\n+                self.stream_contents.append(marshalled['data'])\n+            else:\n+                self.stream_file[k] = marshalled[k]\n \n-\tself.stream_have_file_info = True\n+        self.stream_have_file_info = True\n \n     # Stream directly from \"p4 files\" into \"git fast-import\"\n     def streamP4Files(self, files):\n@@ -1052,23 +1050,22 @@ class P4Sync(Command):\n             self.stream_contents = []\n             self.stream_have_file_info = False\n \n-\t    # curry self argument\n-\t    def streamP4FilesCbSelf(entry):\n-\t\tself.streamP4FilesCb(entry)\n+        # curry self argument\n+        def streamP4FilesCbSelf(entry):\n+            self.streamP4FilesCb(entry)\n \n-\t    p4CmdList(\"-x - print\",\n-\t\t'\\n'.join(['%s#%s' % (f['path'], f['rev'])\n-                                                  for f in filesToRead]),\n-\t        cb=streamP4FilesCbSelf)\n+        p4CmdList(\"-x - print\",\n+                  '\\n'.join(['%s#%s' % (f['path'], f['rev']) for f in filesToRead]),\n+                  cb=streamP4FilesCbSelf)\n \n-            # do the last chunk\n-            if self.stream_file.has_key('depotFile'):\n-                self.streamOneP4File(self.stream_file, self.stream_contents)\n+        # do the last chunk\n+        if self.stream_file.has_key('depotFile'):\n+            self.streamOneP4File(self.stream_file, self.stream_contents)\n \n     def commit(self, details, files, branch, branchPrefixes, parent = \"\"):\n         epoch = details[\"time\"]\n         author = details[\"user\"]\n-\tself.branchPrefixes = branchPrefixes\n+        self.branchPrefixes = branchPrefixes\n \n         if self.verbose:\n             print \"commit into %s\" % branch\n@@ -1173,7 +1170,7 @@ class P4Sync(Command):\n \n         s = ''\n         for (key, val) in self.users.items():\n-\t    s += \"%s\\t%s\\n\" % (key.expandtabs(1), val.expandtabs(1))\n+            s += \"%s\\t%s\\n\" % (key.expandtabs(1), val.expandtabs(1))\n \n         open(self.getUserCacheFilename(), \"wb\").write(s)\n         self.userMapFromPerforceServer = True\n-- \n1.7.3.2\n\n"},{"id":"158995","messageId":"AANLkTimdMH_HcF-Qk3SSmqT24OgxynYnXpSLiDtU7Y6c@mail.gmail.com","threadId":"26197","inReplyTo":"AANLkTi=sNsDy9oo0iBE-qJwvFSDMFYma3oYhbP1J-th=@mail.gmail.com","subject":"Re: patch for git-p4","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-01-05T21:31:24Z","receivedAt":"2011-01-05T21:31:24Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Wed, Jan 5, 2011 at 2:45 AM, Andrew Garber <andrew@andrewgarber.com> wrote:\n> Hi everyone! This is my first post to the git mailing list.\n>\n\nWelcome!\n\n> I was reading the git-p4 source and noticed that some of the lines are\n> indented using tabs instead of spaces (very bad in Python). Here's a\n> patch against tag v1.7.4-rc0 (commit\n> 01b97a4cb60723d18b437efdc474503d2a9dd384) of the git source repo.\n>\n> Thanks!\n> Andrew Garber\n>\n\nPlease read Documentation/SubmittingPatches for the correct procedure\nfor submitting patches. The two most important things is:\n1) We send patches inline instead of attached (git send-email can do\nthis for you)\n2) You need to add a sign-off\n\nAs a side-note, your commit message has some broken grammar in it.\n\"Some the commits\", I'm guessing you omitted a \"of\" there?\n\nWe tend not to write commit messages in past tence. E.g \"git-p4:\nreplace tabs with spaces\" (notice that I removed a 'd').\n"},{"id":"159002","messageId":"7vfwt7c56w.fsf@alter.siamese.dyndns.org","threadId":"26197","inReplyTo":"AANLkTimdMH_HcF-Qk3SSmqT24OgxynYnXpSLiDtU7Y6c@mail.gmail.com","subject":"Re: patch for git-p4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-05T23:16:07Z","receivedAt":"2011-01-05T23:16:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> We tend not to write commit messages in past tence. E.g \"git-p4:\n> replace tabs with spaces\" (notice that I removed a 'd').\n\nJust for the record, we do not write in present tense either.  That\n\"replace\" is imperative.\n"},{"id":"159011","messageId":"AANLkTikK+q=0STdWOS8W0HKkMniZVg3ey-S5ThEyh50j@mail.gmail.com","threadId":"26197","inReplyTo":"7vfwt7c56w.fsf@alter.siamese.dyndns.org","subject":"Re: patch for git-p4","fromName":"Andrew Garber","fromEmail":"andrew@andrewgarber.com","sentAt":"2011-01-06T00:46:49Z","receivedAt":"2011-01-06T00:46:49Z","isPatch":false,"sender":{"key":"andrew@andrewgarber.com","avatar":"https://avatars.githubusercontent.com/u/265048?v=4"},"body":"I'll fix up the patch and resubmit it properly this weekend. Thanks!\n"}]}