Exemplo n.º 1
0
    def activated(self):
        self._preference_binder('pychron.dvc', ('organization', ))
        self._preference_binder('pychron.github', ('oauth_token', ))
        org = Organization(self.organization)
        org._oauth_token = self.oauth_token

        self.refresh_local_names()
        if self.confirmation_dialog('Check all Repositories for changes'):
            self.find_changes()

        self.repository_names = org.repo_names
Exemplo n.º 2
0
def create_repo_for_existing_local(repo_identifier, root, organization='NMGRLData'):
    from pychron.git_archive.repo_manager import GitRepoManager
    repo = GitRepoManager()
    proot = os.path.join(root, repo_identifier)
    repo.open_repo(proot)

    org = Organization(organization)
    if not org.has_repo(repo_identifier):
        usr = os.environ.get('GITHUB_USER')
        pwd = os.environ.get('GITHUB_PASSWORD')
        org.create_repo(repo_identifier, usr, pwd)
        url = 'https://github.com/{}/{}.git'.format(organization, repo_identifier)
        repo.create_remote(url)
def create_repo_for_existing_local(repo_identifier,
                                   root,
                                   organization='NMGRLData'):
    from pychron.git_archive.repo_manager import GitRepoManager
    repo = GitRepoManager()
    proot = os.path.join(root, repo_identifier)
    repo.open_repo(proot)

    org = Organization(organization)
    if not org.has_repo(repo_identifier):
        usr = os.environ.get('GITHUB_USER')
        pwd = os.environ.get('GITHUB_PASSWORD')
        org.create_repo(repo_identifier, usr, pwd)
        url = 'https://github.com/{}/{}.git'.format(organization,
                                                    repo_identifier)
        repo.create_remote(url)
Exemplo n.º 4
0
    def create_remotes(self):
        cmd = lambda x: ['git', 'remote', 'add', x.remote_name, x.remote_url]
        for si in self.shareables:
            if si.enabled:
                root = si.root
                ret = subprocess.call(cmd(si), cwd=root)

                # check if url exists
                if subprocess.call(['git', 'ls-remote'], cwd=root):
                    # add repo to github
                    org = Organization(self._org, self._usr, self._pwd)
Exemplo n.º 5
0
    def add_experiment(self, identifier, **kw):
        org = Organization(self.organization, usr=self.github_user, pwd=self.github_password)
        if identifier in org.repos:
            self.warning_dialog('Experiment "{}" already exists'.format(identifier))
        else:
            root = os.path.join(paths.experiment_dataset_dir, identifier)

            if os.path.isdir(root):
                self.warning_dialog('{} already exists.'.format(root))
            else:
                if not self.default_team:
                    self.warning_dialog('No default team name set in Preferences.\n'
                                        'Please set a value (e.g "Users") and try creating the experiment again')
                    return False

                self.info('Creating experiment repository. {}'.format(identifier))

                org.create_repo(identifier, **kw)
                org.add_team_to_repository(self.default_team, identifier)

                url = '{}/{}/{}.git'.format(paths.git_base_origin, self.organization, identifier)
                Repo.clone_from(url, root)
                self.db.add_experiment(identifier)
                return True
Exemplo n.º 6
0
 def activated(self):
     self._preference_binder('pychron.dvc', ('organization', ))
     org = Organization(self.organization)
     self.repository_names = org.repos
     self.refresh_local_names()
Exemplo n.º 7
0
def create_github_repo(name):
    org = Organization(ORG)
    if not org.has_repo(name):
        usr = os.environ.get('GITHUB_USER')
        pwd = os.environ.get('GITHUB_PASSWORD')
        org.create_repo(name, usr, pwd)
Exemplo n.º 8
0
def create_github_repo(name):
    org = Organization(ORG)
    if not org.has_repo(name):
        usr = os.environ.get('GITHUB_USER')
        pwd = os.environ.get('GITHUB_PASSWORD')
        org.create_repo(name, usr, pwd)