@@ -468,7 +468,6 @@ class P4Submit(Command):
468
468
optparse .make_option ("--verbose" , dest = "verbose" , action = "store_true" ),
469
469
optparse .make_option ("--origin" , dest = "origin" ),
470
470
optparse .make_option ("--reset" , action = "store_true" , dest = "reset" ),
471
- optparse .make_option ("--direct" , dest = "directSubmit" , action = "store_true" ),
472
471
optparse .make_option ("-M" , dest = "detectRename" , action = "store_true" ),
473
472
]
474
473
self .description = "Submit changes from git to the perforce depot."
@@ -478,7 +477,6 @@ class P4Submit(Command):
478
477
self .interactive = True
479
478
self .firstTime = True
480
479
self .origin = ""
481
- self .directSubmit = False
482
480
self .detectRename = False
483
481
self .verbose = False
484
482
self .isWindows = (platform .system () == "Windows" )
@@ -494,12 +492,9 @@ class P4Submit(Command):
494
492
"maybe you want to call git-p4 submit --reset" % self .configFile )
495
493
496
494
commits = []
497
- if self .directSubmit :
498
- commits .append ("0" )
499
- else :
500
- for line in read_pipe_lines ("git rev-list --no-merges %s..%s" % (self .origin , self .master )):
501
- commits .append (line .strip ())
502
- commits .reverse ()
495
+ for line in read_pipe_lines ("git rev-list --no-merges %s..%s" % (self .origin , self .master )):
496
+ commits .append (line .strip ())
497
+ commits .reverse ()
503
498
504
499
self .config ["commits" ] = commits
505
500
@@ -556,13 +551,9 @@ class P4Submit(Command):
556
551
return template
557
552
558
553
def applyCommit (self , id ):
559
- if self .directSubmit :
560
- print "Applying local change in working directory/index"
561
- diff = self .diffStatus
562
- else :
563
- print "Applying %s" % (read_pipe ("git log --max-count=1 --pretty=oneline %s" % id ))
564
- diffOpts = ("" , "-M" )[self .detectRename ]
565
- diff = read_pipe_lines ("git diff-tree -r %s \" %s^\" \" %s\" " % (diffOpts , id , id ))
554
+ print "Applying %s" % (read_pipe ("git log --max-count=1 --pretty=oneline %s" % id ))
555
+ diffOpts = ("" , "-M" )[self .detectRename ]
556
+ diff = read_pipe_lines ("git diff-tree -r %s \" %s^\" \" %s\" " % (diffOpts , id , id ))
566
557
filesToAdd = set ()
567
558
filesToDelete = set ()
568
559
editedFiles = set ()
@@ -597,10 +588,7 @@ class P4Submit(Command):
597
588
else :
598
589
die ("unknown modifier %s for %s" % (modifier , path ))
599
590
600
- if self .directSubmit :
601
- diffcmd = "cat \" %s\" " % self .diffFile
602
- else :
603
- diffcmd = "git format-patch -k --stdout \" %s^\" ..\" %s\" " % (id , id )
591
+ diffcmd = "git format-patch -k --stdout \" %s^\" ..\" %s\" " % (id , id )
604
592
patchcmd = diffcmd + " | git apply "
605
593
tryPatchCmd = patchcmd + "--check -"
606
594
applyPatchCmd = patchcmd + "--check --apply -"
@@ -648,12 +636,10 @@ class P4Submit(Command):
648
636
mode = filesToChangeExecBit [f ]
649
637
setP4ExecBit (f , mode )
650
638
651
- logMessage = ""
652
- if not self .directSubmit :
653
- logMessage = extractLogMessageFromGitCommit (id )
654
- if self .isWindows :
655
- logMessage = logMessage .replace ("\n " , "\r \n " )
656
- logMessage = logMessage .strip ()
639
+ logMessage = extractLogMessageFromGitCommit (id )
640
+ if self .isWindows :
641
+ logMessage = logMessage .replace ("\n " , "\r \n " )
642
+ logMessage = logMessage .strip ()
657
643
658
644
template = self .prepareSubmitTemplate ()
659
645
@@ -692,12 +678,6 @@ class P4Submit(Command):
692
678
if self .isWindows :
693
679
submitTemplate = submitTemplate .replace ("\r \n " , "\n " )
694
680
695
- if self .directSubmit :
696
- print "Submitting to git first"
697
- os .chdir (self .oldWorkingDirectory )
698
- write_pipe ("git commit -a -F -" , submitTemplate )
699
- os .chdir (self .clientPath )
700
-
701
681
write_pipe ("p4 submit -i" , submitTemplate )
702
682
else :
703
683
fileName = "submit.txt"
@@ -739,17 +719,6 @@ class P4Submit(Command):
739
719
print "Perforce checkout for depot path %s located at %s" % (self .depotPath , self .clientPath )
740
720
self .oldWorkingDirectory = os .getcwd ()
741
721
742
- if self .directSubmit :
743
- self .diffStatus = read_pipe_lines ("git diff -r --name-status HEAD" )
744
- if len (self .diffStatus ) == 0 :
745
- print "No changes in working directory to submit."
746
- return True
747
- patch = read_pipe ("git diff -p --binary --diff-filter=ACMRTUXB HEAD" )
748
- self .diffFile = self .gitdir + "/p4-git-diff"
749
- f = open (self .diffFile , "wb" )
750
- f .write (patch )
751
- f .close ();
752
-
753
722
os .chdir (self .clientPath )
754
723
print "Syncronizing p4 checkout..."
755
724
system ("p4 sync ..." )
@@ -777,9 +746,6 @@ class P4Submit(Command):
777
746
778
747
self .config .close ()
779
748
780
- if self .directSubmit :
781
- os .remove (self .diffFile )
782
-
783
749
if len (commits ) == 0 :
784
750
if self .firstTime :
785
751
print "No changes found to apply between %s and current HEAD" % self .origin
0 commit comments