%PDF- %PDF-
Direktori : /proc/985914/root/data/old/home/stash/stash/atlassian-stash/static/model/ |
Current File : //proc/985914/root/data/old/home/stash/stash/atlassian-stash/static/model/revision-reference-min.js |
define("model/revision-reference",["backbone-brace","underscore","model/page-state","model/repository"],function(E,C,D,A){var B={TAG:{id:"tag",name:AJS.I18n.getText("stash.web.revisionref.tag.name")},BRANCH:{id:"branch",name:AJS.I18n.getText("stash.web.revisionref.branch.name")},COMMIT:{id:"commit",name:AJS.I18n.getText("stash.web.revisionref.commit.name")},isTag:function(G){return G&&(G===B.TAG.id||G.id===B.TAG.id)},isBranch:function(G){return G&&(G===B.BRANCH.id||G.id===B.BRANCH.id)},isCommit:function(G){return G&&(G===B.COMMIT.id||G.id===B.COMMIT.id)},from:function(G){if(B.isTag(G)){return B.TAG}else{if(B.isBranch(G)){return B.BRANCH}else{if(B.isCommit(G)){return B.COMMIT}}}window.console&&console.error("Unknown RevisionReference type "+G);return null}};var F=E.Model.extend({namedAttributes:{id:"string",displayId:"string",type:B.from,isDefault:"boolean",latestChangeset:"string",hash:"string",repository:A},initialize:function(){if(!this.getDisplayId()){this.setDisplayId(this.getId())}if(!this.getIsDefault()){this.setIsDefault(false)}if(!this.getRepository()){this.setRepository(D.getRepository())}},getTypeName:function(){return this.getType().name},isDefault:function(){return this.get("isDefault")||false},isTag:function(){return B.isTag(this.getType())},isBranch:function(){return B.isBranch(this.getType())},isCommit:function(){return B.isCommit(this.getType())},isEqual:function(G){return(G instanceof F)&&this.getId()===G.getId()&&this.getType().id===G.getType().id&&this.getRepository().isEqual(G.getRepository())}},{fromChangeset:function(G){return new F({id:G.id,displayId:G.displayId,type:B.COMMIT,isDefault:false})},hydrateRefFromId:function(M,L,J,K){if(!C.isString(M)){return null}var G=/^refs\/(heads|tags)\/(.+)/;var I=M.replace(G,"$2");if(!J){J=F.type.BRANCH;var H=M.match(G);if(H&&H[1]==="tags"){J=F.type.TAG}}return new F({id:M,displayId:I,type:J,isDefault:L,latestChangeset:K})},hydrateDeprecated:function(G){if(!G.__json){return new F(G.toJSON())}return new F(G.__json)}});F.type=B;return F});