summaryrefslogtreecommitdiff
path: root/doPullOld.go
blob: fc0ef18fbfa15f6d70fb58cb9fa5907196641fb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

/*
func rillPull(repo *gitpb.Repo) error {
	if repo.IsDirty() {
		// never do dirty repos
		return nil
	}
	t, _ := repo.LastGitPull()
	if time.Since(t) < time.Minute*10 && !argv.Force {
		if argv.Verbose {
			log.Info(repo.GetFullPath(), "git pulled too recently", shell.FormatDuration(time.Since(t)))
		}
		return nil
	}
	cur := repo.GetCurrentBranchName()
	if !repo.IsBranchRemote(cur) {
		if argv.Verbose {
			log.Info(repo.GetFullPath(), "branch is not remote", cur)
		}
		return nil
	}

	var cmd []string
	cmd = append(cmd, "git", "pull")
	err := repo.RunVerbose(cmd)
	if err != nil {
		log.Info(repo.GetFullPath(), "git pull err:", err)
	}
	return nil
}

// git fetch origin master:master
func rillFetchMaster(repo *gitpb.Repo) error {
	if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
		// only fetch when branch is on the user branch
		return nil
	}
	branch := repo.GetMasterBranchName()
	cmd := []string{"git", "fetch", "origin", branch + ":" + branch}
	err := repo.RunVerbose(cmd)
	return err
}

func doGitFetch() {
	me.forge.RillFuncError(rillFetchMaster)
	count := me.forge.RillReload()
	if count != 0 {
		me.forge.ConfigSave()
	}
}
*/