Beispiel #1
0
Datei: vcs.go Projekt: aaa707/ghq
		dir, _ := filepath.Split(local)
		err := os.MkdirAll(dir, 0755)
		if err != nil {
			return err
		}

		args := []string{"clone"}
		if shallow {
			args = append(args, "--depth", "1")
		}
		args = append(args, remote.String(), local)

		return utils.Run("git", args...)
	},
	Update: func(local string) error {
		return utils.RunInDir(local, "git", "pull", "--ff-only")
	},
}

var MercurialBackend = &VCSBackend{
	// Mercurial seems not supporting shallow clone currently.
	Clone: func(remote *url.URL, local string, ignoredShallow bool) error {
		dir, _ := filepath.Split(local)
		err := os.MkdirAll(dir, 0755)
		if err != nil {
			return err
		}

		return utils.Run("hg", "clone", remote.String(), local)
	},
	Update: func(local string) error {
Beispiel #2
0
Datei: vcs.go Projekt: mkanai/ghq
		args := []string{"clone"}
		if branch != "" {
			args = append(args, "--branch", branch)
		}
		if shallow {
			args = append(args, "--depth", "1")
		}
		if recursive {
			args = append(args, "--recursive")
		}
		args = append(args, remote.String(), local)

		return utils.Run("git", args...)
	},
	Update: func(local string) error {
		return utils.RunInDir(local, "git", "pull", "--ff-only")
	},
}

var SubversionBackend = &VCSBackend{
	Clone: func(remote *url.URL, local string, ignoredBranch string, shallow bool, ignoredRecursive bool) error {
		dir, _ := filepath.Split(local)
		err := os.MkdirAll(dir, 0755)
		if err != nil {
			return err
		}

		args := []string{"checkout"}
		if shallow {
			args = append(args, "--depth", "1")
		}