def _commitChangeSet(self, authToken, cs, mirror = False,
                         hidden = False, statusPath = None):
        # walk through all of the branches this change set commits to
        # and make sure the user has enough permissions for the operation
        verList = ((x.getName(), x.getOldVersion(), x.getNewVersion())
                    for x in cs.iterNewTroveList())
        self._checkCommitPermissions(authToken, verList, mirror, hidden)

        items = {}
        removedList = []
        # check removed permissions; _checkCommitPermissions can't do
        # this for us since it's based on the trove type
        for troveCs in cs.iterNewTroveList():
            if troveCs.troveType() != trove.TROVE_TYPE_REMOVED:
                continue

            removedList.append(troveCs.getNewNameVersionFlavor())
            (name, version, flavor) = troveCs.getNewNameVersionFlavor()

            if not self.auth.authCheck(authToken, mirror = (mirror or hidden)):
                raise errors.InsufficientPermission
            if not self.auth.check(authToken, remove = True,
                                   label = version.branch().label(),
                                   trove = name):
                raise errors.InsufficientPermission

            items.setdefault((version, flavor), []).append(name)

        self.log(2, authToken[0], 'mirror=%s' % (mirror,),
                 [ (x[1], x[0][0].asString(), x[0][1]) for x in items.iteritems() ])
        self.repos.commitChangeSet(cs, mirror = mirror,
                                   hidden = hidden,
                                   serialize = self.serializeCommits,
                                   statusPath=statusPath)

        if not self.commitAction:
            return True

        userName = authToken[0]
        if not isinstance(userName, basestring):
            if userName.username:
                # A ValidUser token with a username specified.
                userName = userName.username
            else:
                # No username available.
                userName = 'unknown'

        d = { 'reppath' : self.urlBase(urlName = False),
              'user' : userName,
              }
        cmd = self.commitAction % d
        p = util.popen(cmd, "w")
        try:
            for troveCs in cs.iterNewTroveList():
                p.write("%s\n%s\n%s\n" %(troveCs.getName(),
                                         troveCs.getNewVersion().asString(),
                                         deps.formatFlavor(troveCs.getNewFlavor())))
            p.close()
        except (__HOLE__, RuntimeError), e:
            # util.popen raises RuntimeError on error.  p.write() raises
            # IOError on error (broken pipe, etc)
            # FIXME: use a logger for this
            sys.stderr.write('commitaction failed: %s\n' %e)
            sys.stderr.flush()
        except Exception, e:
            sys.stderr.write('unexpected exception occurred when running '
                             'commitaction: %s\n' %e)
            sys.stderr.flush()

        return True
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/netserver.py/NetworkRepositoryServer._commitChangeSet