コード例 #1
0
def dump_hg_database(db, client, rc):
    """Dumps an hg database"""
    dbdir = dbdirname(db, rc)
    # dump all of the data
    to_add = client.dump_database(db)
    # update the repo
    hgclient = hglib.open(dbdir)
    if len(hgclient.status(include=to_add, modified=True,
                           unknown=True, added=True)) == 0:
        return
    hgclient.commit(message='regolith auto-commit', include=to_add,
                    addremove=True)
    hgclient.push()
コード例 #2
0
def load_git_database(db, client, rc):
    """Loads a git database"""
    dbdir = dbdirname(db, rc)
    # get or update the database
    if os.path.isdir(dbdir):
        cmd = ['git', 'pull']
        cwd = dbdir
    else:
        cmd = ['git', 'clone', db['url'], dbdir]
        cwd = None
    subprocess.check_call(cmd, cwd=cwd)
    # import all of the data
    client.load_database(db)
コード例 #3
0
ファイル: database.py プロジェクト: scopatz/regolith
def dump_hg_database(db, client, rc):
    """Dumps an hg database"""
    dbdir = dbdirname(db, rc)
    # dump all of the data
    to_add = client.dump_database(db)
    # update the repo
    hgclient = hglib.open(dbdir)
    if len(hgclient.status(include=to_add, modified=True,
                           unknown=True, added=True)) == 0:
        return
    hgclient.commit(message='regolith auto-commit', include=to_add,
                    addremove=True)
    hgclient.push()
コード例 #4
0
ファイル: database.py プロジェクト: scopatz/regolith
def load_git_database(db, client, rc):
    """Loads a git database"""
    dbdir = dbdirname(db, rc)
    # get or update the database
    if os.path.isdir(dbdir):
        cmd = ['git', 'pull']
        cwd = dbdir
    else:
        cmd = ['git', 'clone', db['url'], dbdir]
        cwd = None
    subprocess.check_call(cmd, cwd=cwd)
    # import all of the data
    client.load_database(db)
コード例 #5
0
def load_hg_database(db, client, rc):
    """Loads an hg database"""
    if hglib is None:
        raise ImportError('hglib')
    dbdir = dbdirname(db, rc)
    # get or update the database
    if os.path.isdir(dbdir):
        client = hglib.open(dbdir)
        client.pull(update=True, force=True)
    else:
        # Strip off three characters for hg+
        client = hglib.clone(db['url'][3:], dbdir)
    # import all of the data
    client.load_database(db)
コード例 #6
0
ファイル: database.py プロジェクト: scopatz/regolith
def load_hg_database(db, client, rc):
    """Loads an hg database"""
    if hglib is None:
        raise ImportError('hglib')
    dbdir = dbdirname(db, rc)
    # get or update the database
    if os.path.isdir(dbdir):
        client = hglib.open(dbdir)
        client.pull(update=True, force=True)
    else:
        # Strip off three characters for hg+
        client = hglib.clone(db['url'][3:], dbdir)
    # import all of the data
    client.load_database(db)
コード例 #7
0
def dump_git_database(db, client, rc):
    """Dumps a git database"""
    dbdir = dbdirname(db, rc)
    # dump all of the data
    to_add = client.dump_database(db)
    # update the repo
    cmd = ['git', 'add'] + to_add
    subprocess.check_call(cmd, cwd=dbdir)
    cmd = ['git', 'commit', '-m', 'regolith auto-commit']
    try:
        subprocess.check_call(cmd, cwd=dbdir)
    except subprocess.CalledProcessError:
        warn('Could not git commit to ' + dbdir, RuntimeWarning)
        return
    cmd = ['git', 'push']
    try:
        subprocess.check_call(cmd, cwd=dbdir)
    except subprocess.CalledProcessError:
        warn('Could not git push from ' + dbdir, RuntimeWarning)
        return
コード例 #8
0
ファイル: database.py プロジェクト: scopatz/regolith
def dump_git_database(db, client, rc):
    """Dumps a git database"""
    dbdir = dbdirname(db, rc)
    # dump all of the data
    to_add = client.dump_database(db)
    # update the repo
    cmd = ['git', 'add'] + to_add
    subprocess.check_call(cmd, cwd=dbdir)
    cmd = ['git', 'commit', '-m', 'regolith auto-commit']
    try:
        subprocess.check_call(cmd, cwd=dbdir)
    except subprocess.CalledProcessError:
        warn('Could not git commit to ' + dbdir, RuntimeWarning)
        return
    cmd = ['git', 'push']
    try:
        subprocess.check_call(cmd, cwd=dbdir)
    except subprocess.CalledProcessError:
        warn('Could not git push from ' + dbdir, RuntimeWarning)
        return