* patch for git-p4
@ 2011-01-05 1:45 Andrew Garber
2011-01-05 21:31 ` Erik Faye-Lund
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Garber @ 2011-01-05 1:45 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
Hi everyone! This is my first post to the git mailing list.
I was reading the git-p4 source and noticed that some of the lines are
indented using tabs instead of spaces (very bad in Python). Here's a
patch against tag v1.7.4-rc0 (commit
01b97a4cb60723d18b437efdc474503d2a9dd384) of the git source repo.
Thanks!
Andrew Garber
[-- Attachment #2: git-p4_tabs_to_spaces.patch --]
[-- Type: application/octet-stream, Size: 5057 bytes --]
From ce7ff27529bb5ec608ba6b6a841ce2f3ce605a3c Mon Sep 17 00:00:00 2001
From: Andrew Garber <andrew@andrewgarber.com>
Date: Wed, 29 Dec 2010 00:23:05 -0800
Subject: [PATCH] git-p4: replaced tabs with spaces
Some the commits to git-p4 used tabs for indenting instead of spaces. I
also did some minor reformatting.
---
contrib/fast-import/git-p4 | 71 +++++++++++++++++++++-----------------------
1 files changed, 34 insertions(+), 37 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 04ce7e3..449df2e 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -222,10 +222,10 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
try:
while True:
entry = marshal.load(p4.stdout)
- if cb is not None:
- cb(entry)
- else:
- result.append(entry)
+ if cb is not None:
+ cb(entry)
+ else:
+ result.append(entry)
except EOFError:
pass
exitCode = p4.wait()
@@ -445,8 +445,8 @@ def p4ChangesForPaths(depotPaths, changeRange):
changes = {}
for line in output:
- changeNum = int(line.split(" ")[1])
- changes[changeNum] = True
+ changeNum = int(line.split(" ")[1])
+ changes[changeNum] = True
changelist = changes.keys()
changelist.sort()
@@ -954,10 +954,9 @@ class P4Sync(Command):
# - helper for streamP4Files
def streamOneP4File(self, file, contents):
- if file["type"] == "apple":
- print "\nfile %s is a strange apple file that forks. Ignoring" % \
- file['depotFile']
- return
+ if file["type"] == "apple":
+ print "\nfile %s is a strange apple file that forks. Ignoring" % file['depotFile']
+ return
relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
if verbose:
@@ -1004,23 +1003,22 @@ class P4Sync(Command):
# handle another chunk of streaming data
def streamP4FilesCb(self, marshalled):
+ if marshalled.has_key('depotFile') and self.stream_have_file_info:
+ # start of a new file - output the old one first
+ self.streamOneP4File(self.stream_file, self.stream_contents)
+ self.stream_file = {}
+ self.stream_contents = []
+ self.stream_have_file_info = False
- if marshalled.has_key('depotFile') and self.stream_have_file_info:
- # start of a new file - output the old one first
- self.streamOneP4File(self.stream_file, self.stream_contents)
- self.stream_file = {}
- self.stream_contents = []
- self.stream_have_file_info = False
-
- # pick up the new file information... for the
- # 'data' field we need to append to our array
- for k in marshalled.keys():
- if k == 'data':
- self.stream_contents.append(marshalled['data'])
- else:
- self.stream_file[k] = marshalled[k]
+ # pick up the new file information... for the
+ # 'data' field we need to append to our array
+ for k in marshalled.keys():
+ if k == 'data':
+ self.stream_contents.append(marshalled['data'])
+ else:
+ self.stream_file[k] = marshalled[k]
- self.stream_have_file_info = True
+ self.stream_have_file_info = True
# Stream directly from "p4 files" into "git fast-import"
def streamP4Files(self, files):
@@ -1052,23 +1050,22 @@ class P4Sync(Command):
self.stream_contents = []
self.stream_have_file_info = False
- # curry self argument
- def streamP4FilesCbSelf(entry):
- self.streamP4FilesCb(entry)
+ # curry self argument
+ def streamP4FilesCbSelf(entry):
+ self.streamP4FilesCb(entry)
- p4CmdList("-x - print",
- '\n'.join(['%s#%s' % (f['path'], f['rev'])
- for f in filesToRead]),
- cb=streamP4FilesCbSelf)
+ p4CmdList("-x - print",
+ '\n'.join(['%s#%s' % (f['path'], f['rev']) for f in filesToRead]),
+ cb=streamP4FilesCbSelf)
- # do the last chunk
- if self.stream_file.has_key('depotFile'):
- self.streamOneP4File(self.stream_file, self.stream_contents)
+ # do the last chunk
+ if self.stream_file.has_key('depotFile'):
+ self.streamOneP4File(self.stream_file, self.stream_contents)
def commit(self, details, files, branch, branchPrefixes, parent = ""):
epoch = details["time"]
author = details["user"]
- self.branchPrefixes = branchPrefixes
+ self.branchPrefixes = branchPrefixes
if self.verbose:
print "commit into %s" % branch
@@ -1173,7 +1170,7 @@ class P4Sync(Command):
s = ''
for (key, val) in self.users.items():
- s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1))
+ s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1))
open(self.getUserCacheFilename(), "wb").write(s)
self.userMapFromPerforceServer = True
--
1.7.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: patch for git-p4
2011-01-05 1:45 patch for git-p4 Andrew Garber
@ 2011-01-05 21:31 ` Erik Faye-Lund
2011-01-05 23:16 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Erik Faye-Lund @ 2011-01-05 21:31 UTC (permalink / raw)
To: Andrew Garber; +Cc: git
On Wed, Jan 5, 2011 at 2:45 AM, Andrew Garber <andrew@andrewgarber.com> wrote:
> Hi everyone! This is my first post to the git mailing list.
>
Welcome!
> I was reading the git-p4 source and noticed that some of the lines are
> indented using tabs instead of spaces (very bad in Python). Here's a
> patch against tag v1.7.4-rc0 (commit
> 01b97a4cb60723d18b437efdc474503d2a9dd384) of the git source repo.
>
> Thanks!
> Andrew Garber
>
Please read Documentation/SubmittingPatches for the correct procedure
for submitting patches. The two most important things is:
1) We send patches inline instead of attached (git send-email can do
this for you)
2) You need to add a sign-off
As a side-note, your commit message has some broken grammar in it.
"Some the commits", I'm guessing you omitted a "of" there?
We tend not to write commit messages in past tence. E.g "git-p4:
replace tabs with spaces" (notice that I removed a 'd').
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: patch for git-p4
2011-01-05 21:31 ` Erik Faye-Lund
@ 2011-01-05 23:16 ` Junio C Hamano
2011-01-06 0:46 ` Andrew Garber
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2011-01-05 23:16 UTC (permalink / raw)
To: kusmabite; +Cc: Andrew Garber, git
Erik Faye-Lund <kusmabite@gmail.com> writes:
> We tend not to write commit messages in past tence. E.g "git-p4:
> replace tabs with spaces" (notice that I removed a 'd').
Just for the record, we do not write in present tense either. That
"replace" is imperative.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: patch for git-p4
2011-01-05 23:16 ` Junio C Hamano
@ 2011-01-06 0:46 ` Andrew Garber
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Garber @ 2011-01-06 0:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Erik Faye-Lund, git
I'll fix up the patch and resubmit it properly this weekend. Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-06 0:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 1:45 patch for git-p4 Andrew Garber
2011-01-05 21:31 ` Erik Faye-Lund
2011-01-05 23:16 ` Junio C Hamano
2011-01-06 0:46 ` Andrew Garber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).