lib/sysrev/sysrev.js
function(user, systemId, revisionId, env, cb) {
    var repoPath = _meta.repoPath(systemId);
    var removeTag;
    var addTag;
    var revId;
    
    getComittedHeadRevisionId(systemId, function(err, comittedHeadId) {
      if (revisionId === EDITS) {
        removeTag = baseTag + env;
        addTag = editsTag + env;
        revId = comittedHeadId;
      }
      else {
        addTag = baseTag + env;
        removeTag = editsTag + env;
        revId = revisionId;
      }

      ngit.Repository.open(repoPath, function(err, repo) {
        if (err) { return cb(err); }
        ngit.Reference.remove(repo, removeTag);
        repo.getCommit(revId, function(err, commit) {
          if (err) { return cb(err); }
          var now = Math.round(Date.now() / 1000);
          var author = ngit.Signature.create(user.name, user.email, now, 0);
          ngit.Reference.create(repo, addTag, commit, 1, author, 'Tagged ' + addTag)
            .then(function() {
              writeTimeline(user, systemId, 'deployed revision', revisionId, function() {
                cb();
              });
            })
            .catch(cb);
        });
      });
    });
  }
function(user, systemId, revisionId, env, cb) {
    var repoPath = _meta.repoPath(systemId);
    var removeTag;
    var addTag;
    var revId;
    
    getComittedHeadRevisionId(systemId, function(err, comittedHeadId) {
      if (revisionId === EDITS) {
        removeTag = baseTag + env;
        addTag = editsTag + env;
        revId = comittedHeadId;
      }
      else {
        addTag = baseTag + env;
        removeTag = editsTag + env;
        revId = revisionId;
      }

      ngit.Repository.open(repoPath, function(err, repo) {
        if (err) { return cb(err); }
        ngit.Reference.remove(repo, removeTag);
        repo.getCommit(revId, function(err, commit) {
          if (err) { return cb(err); }
          var now = Math.round(Date.now() / 1000);
          var author = ngit.Signature.create(user.name, user.email, now, 0);
          ngit.Reference.create(repo, addTag, commit, 1, author, 'Tagged ' + addTag)
            .then(function() {
              writeTimeline(user, systemId, 'deployed revision', revisionId, function() {
                cb();
              });
            })
            .catch(cb);
        });
      });
    });
  }
function ( user , systemId , revisionId , env , cb ) { var repoPath = _meta . repoPath ( systemId ) ; var removeTag ; var addTag ; var revId ; getComittedHeadRevisionId ( systemId , function ( err , comittedHeadId ) { if ( revisionId === EDITS ) { removeTag = baseTag + env ; addTag = editsTag + env ; revId = comittedHeadId ; } else { addTag = baseTag + env ; removeTag = editsTag + env ; revId = revisionId ; } ngit . Repository . open ( repoPath , function ( err , repo ) { if ( err ) { return cb ( err ) ; } ngit . Reference . remove ( repo , removeTag ) ; repo . getCommit ( revId , function ( err , commit ) { if ( err ) { return cb ( err ) ; } var now = Math . round ( Date . now ( ) / 1000 ) ; var author = ngit . Signature . create ( user . name , user . email , now , 0 ) ; ngit . Reference . create ( repo , addTag , commit , 1 , author , 'Tagged ' + addTag ) . then ( function ( ) { writeTimeline ( user , systemId , 'deployed revision' , revisionId , function ( ) { cb ( ) ; } ) ; } ) . catch ( cb ) ; } ) ; } ) ; } ) ; }
/*
tesnt this to fuck and PR and release
move onto proxy - must be testing it tomorrow night
app dynamics only - load to AJ
 
set the currently deployed revision, there will only ever be one deployed revision
clear the currently deployed flag and set the deployed flag against the specified revision
/ * tesnt this to fuck and PR and release move onto proxy - must be testing it tomorrow night app dynamics only - load to AJ set the currently deployed revision there will only ever be one deployed revision clear the currently deployed flag and set the deployed flag against the specified revision