@@ -571,20 +571,44 @@ WOQLClient.prototype.branch = function(new_branch_id, source_free) {
571
571
}
572
572
573
573
/**
574
- * Creates a branch starting from the current branch
574
+ * Squash branch commits
575
575
* @param {string } branch_id - local identifier of the new branch
576
576
* @param {string } commit_msg - Textual message describing the reason for the update
577
577
* @returns {Promise }
578
578
*/
579
- WOQLClient . prototype . resetBranch = function ( branch_id , commit_msg ) {
579
+ WOQLClient . prototype . squashBranch = function ( branch_id , commit_msg ) {
580
580
if ( commit_msg && branch_id ) {
581
581
let commit = this . generateCommitInfo ( commit_msg )
582
- return this . dispatch ( CONST . RESET_BRANCH , this . connectionConfig . squashBranchURL ( branch_id ) , commit )
582
+ return this . dispatch ( CONST . SQUASH_BRANCH , this . connectionConfig . squashBranchURL ( branch_id ) , commit )
583
583
}
584
584
let errmsg = `Branch parameter error - you must specify a valid new branch id and a commit message`
585
- return Promise . reject ( new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . BRANCH , errmsg ) ) )
585
+ return Promise . reject ( new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . SQUASH_BRANCH , errmsg ) ) )
586
586
}
587
587
588
+ /**
589
+ * Reset branch to a commit descriptor
590
+ * @param {string } branch_id - local identifier of the new branch
591
+ * @param {string } commit_descriptor - a valid commit descriptor
592
+ * @returns {Promise }
593
+ */
594
+ WOQLClient . prototype . resetBranch = function ( branch_id , commit_descriptor ) {
595
+ if ( commit_descriptor && branch_id ) {
596
+ let commit = this . generateCommitDescriptor ( commit_descriptor )
597
+ return this . dispatch ( CONST . RESET_BRANCH , this . connectionConfig . squashBranchURL ( ) , commit )
598
+ }
599
+ let errmsg = `Branch parameter error - you must specify a valid new branch id and a commit message`
600
+ return Promise . reject ( new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . RESET_BRANCH , errmsg ) ) )
601
+ }
602
+
603
+ /**
604
+ * Optimize system
605
+ * @returns {Promise }
606
+ */
607
+ WOQLClient . prototype . optimize_system = function ( ) {
608
+ return this . dispatch ( CONST . OPTIMIZE_SYSTEM , this . connectionConfig . optimizeSystemUrl ( ) )
609
+ }
610
+
611
+
588
612
/**
589
613
* deletes a branch from database
590
614
* @param {string } branch_id - local identifier of the branch
@@ -709,6 +733,15 @@ WOQLClient.prototype.generateCommitInfo = function(msg, author) {
709
733
return ci
710
734
}
711
735
736
+ /**
737
+ * Generates the json structure for commit descriptor
738
+ * @param {string } commit_descriptor - a valid commit descriptor
739
+ */
740
+ WOQLClient . prototype . generateCommitDescriptor = function ( commit_descriptor ) {
741
+ let ci = { commit_descriptor : commit_descriptor }
742
+ return ci
743
+ }
744
+
712
745
/**
713
746
* Adds an author string (from the user object returned by connect) to the commit message.
714
747
* @param {object } rc_args
0 commit comments