File: helpers.py

package info (click to toggle)
yarsync 0.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 652 kB
  • sloc: python: 2,615; makefile: 22
file content (18 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import subprocess


def clone_repo(from_path, to_path):
    if not from_path.endswith(os.path.sep):
        from_path += os.path.sep
    rsync_command = (
        "rsync -avHP --delete-after "  # --filter='merge .ys/rsync-filter' "
        # we also copy configuration files,
        # because we need a real repository
        # with config.ini, etc.
        # "--include=/.ys/commits --include=/.ys/logs --exclude=/.ys/* "
        + from_path + " " + to_path
    )
    print(rsync_command)
    subprocess.check_call(rsync_command, shell=True,
                          stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)