Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Added support for --silent so that p4-fast-export can be called from cronjobs.
author
Simon Hausmann
<hausmann@kde.org>
Thu, 22 Feb 2007 08:03:39 +0000
(09:03 +0100)
committer
Simon Hausmann
<hausmann@kde.org>
Thu, 22 Feb 2007 08:03:39 +0000
(09:03 +0100)
Signed-off-by: Simon Hausmann <hausmann@kde.org>
contrib/fast-import/p4-fast-export.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
9c9fec3
)
diff --git
a/contrib/fast-import/p4-fast-export.py
b/contrib/fast-import/p4-fast-export.py
index 6fd86cf7351b680121295495f2cba7559d803d00..b39548917a611de6980dabff84a60e35ac7bc72d 100755
(executable)
--- a/
contrib/fast-import/p4-fast-export.py
+++ b/
contrib/fast-import/p4-fast-export.py
@@
-15,6
+15,7
@@
import marshal, popen2, getopt
from sets import Set;
import marshal, popen2, getopt
from sets import Set;
+silent = False
knownBranches = Set()
committedChanges = Set()
branch = "refs/heads/master"
knownBranches = Set()
committedChanges = Set()
branch = "refs/heads/master"
@@
-25,7
+26,7
@@
globalPrefix = globalPrefix[:-1]
try:
globalPrefix = globalPrefix[:-1]
try:
- opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=", "detect-branches", "changesfile=" ])
+ opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=", "detect-branches", "changesfile="
, "silent"
])
except getopt.GetoptError:
print "fixme, syntax error"
sys.exit(1)
except getopt.GetoptError:
print "fixme, syntax error"
sys.exit(1)
@@
-37,6
+38,8
@@
detectBranches = True
elif o == "--changesfile":
changesFile = a
detectBranches = True
elif o == "--changesfile":
changesFile = a
+ elif o == "--silent":
+ silent= True
if len(args) == 0 and len(globalPrefix) != 0:
print "[using previously specified depot path %s]" % globalPrefix
if len(args) == 0 and len(globalPrefix) != 0:
print "[using previously specified depot path %s]" % globalPrefix
@@
-110,7
+113,8
@@
def extractFilesFromCommit(commit):
while commit.has_key("depotFile%s" % fnum):
path = commit["depotFile%s" % fnum]
if not path.startswith(globalPrefix):
while commit.has_key("depotFile%s" % fnum):
path = commit["depotFile%s" % fnum]
if not path.startswith(globalPrefix):
- print "\nchanged files: ignoring path %s outside of %s in change %s" % (path, globalPrefix, change)
+ if not silent:
+ print "\nchanged files: ignoring path %s outside of %s in change %s" % (path, globalPrefix, change)
fnum = fnum + 1
continue
fnum = fnum + 1
continue
@@
-272,7
+276,8
@@
def commit(details, files, branch, branchPrefix):
for file in files:
path = file["path"]
if not path.startswith(branchPrefix):
for file in files:
path = file["path"]
if not path.startswith(branchPrefix):
- print "\nchanged files: ignoring path %s outside of branch prefix %s in change %s" % (path, branchPrefix, details["change"])
+ if not silent:
+ print "\nchanged files: ignoring path %s outside of branch prefix %s in change %s" % (path, branchPrefix, details["change"])
continue
rev = file["rev"]
depotPath = path + "#" + rev
continue
rev = file["rev"]
depotPath = path + "#" + rev
@@
-387,15
+392,17
@@
def getUserMap():
changes.reverse()
if len(changes) == 0:
changes.reverse()
if len(changes) == 0:
- print "no changes to import!"
+ if not silent:
+ print "no changes to import!"
sys.exit(1)
cnt = 1
for change in changes:
description = p4Cmd("describe %s" % change)
sys.exit(1)
cnt = 1
for change in changes:
description = p4Cmd("describe %s" % change)
- sys.stdout.write("\rimporting revision %s (%s%%)" % (change, cnt * 100 / len(changes)))
- sys.stdout.flush()
+ if not silent:
+ sys.stdout.write("\rimporting revision %s (%s%%)" % (change, cnt * 100 / len(changes)))
+ sys.stdout.flush()
cnt = cnt + 1
# try:
cnt = cnt + 1
# try:
@@
-412,7
+419,8
@@
def getUserMap():
# print gitError.read()
# sys.exit(1)
# print gitError.read()
# sys.exit(1)
-print ""
+if not silent:
+ print ""
gitStream.write("reset refs/tags/p4/%s\n" % lastChange)
gitStream.write("from %s\n\n" % branch);
gitStream.write("reset refs/tags/p4/%s\n" % lastChange)
gitStream.write("from %s\n\n" % branch);