@@ -571,20 +571,44 @@ WOQLClient.prototype.branch = function(new_branch_id, source_free) {
571571}
572572
573573/**
574- * Creates a branch starting from the current branch
574+ * Squash branch commits
575575 * @param {string } branch_id - local identifier of the new branch
576576 * @param {string } commit_msg - Textual message describing the reason for the update
577577 * @returns {Promise }
578578 */
579- WOQLClient . prototype . resetBranch = function ( branch_id , commit_msg ) {
579+ WOQLClient . prototype . squashBranch = function ( branch_id , commit_msg ) {
580580 if ( commit_msg && branch_id ) {
581581 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 )
583583 }
584584 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 ) ) )
586586}
587587
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+
588612/**
589613 * deletes a branch from database
590614 * @param {string } branch_id - local identifier of the branch
@@ -709,6 +733,15 @@ WOQLClient.prototype.generateCommitInfo = function(msg, author) {
709733 return ci
710734}
711735
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+
712745/**
713746 * Adds an author string (from the user object returned by connect) to the commit message.
714747 * @param {object } rc_args
0 commit comments