@@ -464,18 +464,13 @@ class P4Submit(Command):
464
464
def __init__ (self ):
465
465
Command .__init__ (self )
466
466
self .options = [
467
- optparse .make_option ("--continue" , action = "store_false" , dest = "firstTime" ),
468
467
optparse .make_option ("--verbose" , dest = "verbose" , action = "store_true" ),
469
468
optparse .make_option ("--origin" , dest = "origin" ),
470
- optparse .make_option ("--reset" , action = "store_true" , dest = "reset" ),
471
469
optparse .make_option ("-M" , dest = "detectRename" , action = "store_true" ),
472
470
]
473
471
self .description = "Submit changes from git to the perforce depot."
474
472
self .usage += " [name of git branch to submit into perforce depot]"
475
- self .firstTime = True
476
- self .reset = False
477
473
self .interactive = True
478
- self .firstTime = True
479
474
self .origin = ""
480
475
self .detectRename = False
481
476
self .verbose = False
@@ -485,19 +480,6 @@ class P4Submit(Command):
485
480
if len (p4CmdList ("opened ..." )) > 0 :
486
481
die ("You have files opened with perforce! Close them before starting the sync." )
487
482
488
- def start (self ):
489
- if len (self .config ) > 0 and not self .reset :
490
- die ("Cannot start sync. Previous sync config found at %s\n "
491
- "If you want to start submitting again from scratch "
492
- "maybe you want to call git-p4 submit --reset" % self .configFile )
493
-
494
- commits = []
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 ()
498
-
499
- self .config ["commits" ] = commits
500
-
501
483
# replaces everything between 'Description:' and the next P4 submit template field with the
502
484
# commit message
503
485
def prepareLogMessage (self , template , message ):
@@ -723,42 +705,29 @@ class P4Submit(Command):
723
705
print "Syncronizing p4 checkout..."
724
706
system ("p4 sync ..." )
725
707
726
- if self .reset :
727
- self .firstTime = True
728
-
729
708
self .check ()
730
- self .configFile = self .gitdir + "/p4-git-sync.cfg"
731
- self .config = shelve .open (self .configFile , writeback = True )
732
709
733
- if self . firstTime :
734
- self . start ()
735
-
736
- commits = self . config . get ( "commits" , [] )
710
+ commits = []
711
+ for line in read_pipe_lines ( "git rev-list --no-merges %s..%s" % ( self . origin , self . master )):
712
+ commits . append ( line . strip ())
713
+ commits . reverse ( )
737
714
738
715
while len (commits ) > 0 :
739
- self .firstTime = False
740
716
commit = commits [0 ]
741
717
commits = commits [1 :]
742
- self .config ["commits" ] = commits
743
718
self .applyCommit (commit )
744
719
if not self .interactive :
745
720
break
746
721
747
- self .config .close ()
748
-
749
722
if len (commits ) == 0 :
750
- if self .firstTime :
751
- print "No changes found to apply between %s and current HEAD" % self .origin
752
- else :
753
- print "All changes applied!"
754
- os .chdir (self .oldWorkingDirectory )
723
+ print "All changes applied!"
724
+ os .chdir (self .oldWorkingDirectory )
755
725
756
- sync = P4Sync ()
757
- sync .run ([])
726
+ sync = P4Sync ()
727
+ sync .run ([])
758
728
759
- rebase = P4Rebase ()
760
- rebase .rebase ()
761
- os .remove (self .configFile )
729
+ rebase = P4Rebase ()
730
+ rebase .rebase ()
762
731
763
732
return True
764
733
0 commit comments