lib/repos.js
function (cb) {
      async.map(self._repos, function (repo, repoCb) {
        self._client.gitdata.getReference({
          user: self._repoParts[repo].org,
          repo: self._repoParts[repo].repo,
          ref: branchDestFull
        }, function (err, res) {
          // Allow not found.
          if (err && err.code === NOT_FOUND) {
            repoCb(null, {
              repo: repo,
              exists: false,
              sha: null
            });
            return;
          }

          // Real error.
          if (self._checkAndHandleError(err, "branch.getDestRefs - " + repo, repoCb)) {
            return;
          }

          // Error if existing branches are not allowed.
          var sha = res.object.sha;
          if (!self._allowExisting) {
            self._checkAndHandleError(
              new Error("Found existing dest branch in repo: " + repo + " with sha: " + sha),
              null,
              repoCb);
            return;
          }

          // Have an allowed, existing branch.
          repoCb(null, {
            repo: repo,
            exists: true,
            sha: sha
          });
        });
      }, cb);
    }
function (cb) {
      async.map(self._repos, function (repo, repoCb) {
        self._client.gitdata.getReference({
          user: self._repoParts[repo].org,
          repo: self._repoParts[repo].repo,
          ref: branchDestFull
        }, function (err, res) {
          // Allow not found.
          if (err && err.code === NOT_FOUND) {
            repoCb(null, {
              repo: repo,
              exists: false,
              sha: null
            });
            return;
          }

          // Real error.
          if (self._checkAndHandleError(err, "branch.getDestRefs - " + repo, repoCb)) {
            return;
          }

          // Error if existing branches are not allowed.
          var sha = res.object.sha;
          if (!self._allowExisting) {
            self._checkAndHandleError(
              new Error("Found existing dest branch in repo: " + repo + " with sha: " + sha),
              null,
              repoCb);
            return;
          }

          // Have an allowed, existing branch.
          repoCb(null, {
            repo: repo,
            exists: true,
            sha: sha
          });
        });
      }, cb);
    }
function ( cb ) { async . map ( self . _repos , function ( repo , repoCb ) { self . _client . gitdata . getReference ( { user : self . _repoParts [ repo ] . org , repo : self . _repoParts [ repo ] . repo , ref : branchDestFull } , function ( err , res ) { // Allow not found. if ( err && err . code === NOT_FOUND ) { repoCb ( null , { repo : repo , exists : false , sha : null } ) ; return ; } // Real error. if ( self . _checkAndHandleError ( err , "branch.getDestRefs - " + repo , repoCb ) ) { return ; } // Error if existing branches are not allowed. var sha = res . object . sha ; if ( ! self . _allowExisting ) { self . _checkAndHandleError ( new Error ( "Found existing dest branch in repo: " + repo + " with sha: " + sha ) , null , repoCb ) ; return ; } // Have an allowed, existing branch. repoCb ( null , { repo : repo , exists : true , sha : sha } ) ; } ) ; } , cb ) ; }
Check if the destination branches exist.
Check if the destination branches exist .