Skip to content

Commit

Permalink
conflict resolution for pullMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Odeke committed Apr 3, 2015
1 parent 8487a59 commit c5e157a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 12 additions & 4 deletions src/list.go
Expand Up @@ -45,15 +45,17 @@ type traversalSt struct {
inTrash bool
}

func (g *Commands) ListMatches() (error) {
func (g *Commands) ListMatches() error {
matches, err := g.rem.FindMatches(g.opts.Path, g.opts.Sources, g.opts.InTrash)
if err != nil {
return err
}
if err != nil {
return err
}

spin := g.playabler()
spin.play()

traversalCount := 0

for match := range matches {
if match == nil {
continue
Expand All @@ -67,13 +69,19 @@ func (g *Commands) ListMatches() (error) {
mask: g.opts.TypeMask,
}

traversalCount += 1

if !g.breadthFirst(travSt, spin) {
break
}
}

spin.stop()

if traversalCount < 1 {
g.log.LogErrln("no matches found!")
}

return nil
}

Expand Down
14 changes: 11 additions & 3 deletions src/pull.go
Expand Up @@ -104,12 +104,20 @@ func (g *Commands) PullMatches() (err error) {
}

if len(cl) < 1 {
return fmt.Errorf("no matches found!")
return fmt.Errorf("no changes detected!")
}

ok := printChangeList(g.log, cl, !g.opts.canPrompt(), g.opts.NoClobber)
nonConflictsPtr, conflictsPtr := g.resolveConflicts(cl, false)
if conflictsPtr != nil {
warnConflictsPersist(g.log, *conflictsPtr)
return fmt.Errorf("conflicts have prevented a pull operation")
}

nonConflicts := *nonConflictsPtr

ok := printChangeList(g.log, nonConflicts, !g.opts.canPrompt(), g.opts.NoClobber)
if ok {
return g.playPullChangeList(cl, g.opts.Exports)
return g.playPullChangeList(nonConflicts, g.opts.Exports)
}
return nil
}
Expand Down

0 comments on commit c5e157a

Please sign in to comment.