MCPcopy Index your code
hub / github.com/git-bug/git-bug / runPull

Function runPull

commands/pull.go:27–59  ·  view source on GitHub ↗
(env *execenv.Env, args []string)

Source from the content-addressed store, hash-verified

25}
26
27func runPull(env *execenv.Env, args []string) error {
28 if len(args) > 1 {
29 return errors.New("Only pulling from one remote at a time is supported")
30 }
31
32 remote := "origin"
33 if len(args) == 1 {
34 remote = args[0]
35 }
36
37 env.Out.Println("Fetching remote ...")
38
39 stdout, err := env.Backend.Fetch(remote)
40 if err != nil {
41 return err
42 }
43
44 env.Out.Println(stdout)
45
46 env.Out.Println("Merging data ...")
47
48 for result := range env.Backend.MergeAll(remote) {
49 if result.Err != nil {
50 env.Err.Println(result.Err)
51 }
52
53 if result.Status != entity.MergeStatusNothing {
54 env.Out.Printf("%s: %s\n", result.Id.Human(), result)
55 }
56 }
57
58 return nil
59}

Callers 1

newPullCommandFunction · 0.85

Calls 6

FetchMethod · 0.80
PrintlnMethod · 0.65
MergeAllMethod · 0.65
PrintfMethod · 0.65
NewMethod · 0.45
HumanMethod · 0.45

Tested by

no test coverage detected