Example #1
0
func (ch *Checkouter) PullAll() (err error) {
	var waiter sync.WaitGroup

	for _, prj := range ch.wk.ScanRel() {
		if !ch.cloned[prj] { //

			waiter.Add(1)
			go func(prj string) {
				defer waiter.Done()
				res, e := git.Pull(prj, ch.ffonly, ch.rebase)
				if e != nil {
					fmt.Fprintf(ch.w, "ERR  Pulling '%s'   : %q\n%s\n", prj, e.Error(), res)
					if err == nil {
						err = e
					}

				} else {
					fmt.Fprintf(ch.w, "     Pulling '%s'...\n", prj)
				}
			}(prj)
		}
	}
	waiter.Wait() // wait all Pulls

	return nil
}
Example #2
0
//PullTop launches a git pull --ff-only on the Wd top git
func (ch *Checkouter) PullTop() (err error) {
	result, err := git.Pull(ch.wk.Wd(), ch.ffonly, ch.rebase)
	if err != nil {
		fmt.Fprintf(ch.w, "ERR  Pulling '/'   : %q\n%s\n", err.Error(), result)
		return
	}
	fmt.Fprintf(ch.w, "     Pulling '/'...\n")
	return
}