From: Luke Diamand Date: Mon, 17 Oct 2011 18:53:18 GMT Subject: Re: [PATCH] Git-p4: git-p4.changeOnSubmit to do 'change' instead of 'submit'. Message-ID: <4E9C799E.70700@diamand.org> In-Reply-To: <83923897.7841.1318868319131.JavaMail.root@zimbra-prod-mbox-2.vmware.com> On 17/10/11 17:18, Andrei Warkentin wrote: > Hi, > > ----- Original Message ----- > Anyway, the other suggestion I had was to create a new command > instead of overriding behaviour of an existing one. Of course, > copy-pasting P4Submit into P4Change is silly, so... > > How about something like this? > > The commands dict maps command name to class and optional dict passed to cmd.run(). That way 'change' > can really mean P4Submit with an extra parameter not to submit but to do a changelist instead. The > reason why I initially made the config flag was because I didn't want to copy-paste P4Submit into P4Change. > > commands = { > "debug" : [ P4Debug, {} ] > "submit" : [ P4Submit, { "doChange" : 0 } ] > "commit" : [ P4Submit, { "doChange" : 0 } ] > "change" : [ P4Submit, { "doChange" : 1 } ] > "sync" : [ P4Sync, {} ], > "rebase" : [ P4Rebase, {} ], > "clone" : [ P4Clone, {} ], > "rollback" : [ P4RollBack, {} ], > "branches" : [ P4Branches, {} ] > } > > Thanks for the review, > A > Sounds plausible to me. The alternative would be a command line parameter, although that could get annoying and error prone, especially as you can't easily unsubmit a perforce change.