~elopio/snappy-tests-job/bug-create-version-flags

« back to all changes in this revision

Viewing changes to source/source.go

  • Committer: Leo Arias
  • Date: 2015-08-21 04:32:13 UTC
  • mfrom: (60.2.3 merge)
  • Revision ID: leo.arias@canonical.com-20150821043213-k0ud1awuyk4dzyfu
Added a target flag to merge the source before running the tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
// Sourcer is the interface satisfied by all the source handlers
38
38
type Sourcer interface {
39
39
        Get(string) (string, error)
 
40
        Merge(string, string) (string, error)
40
41
}
41
42
 
42
43
// BzrHandler is a source handler for bazaar
60
61
        return filepath.Join(path, targetSubdir), err
61
62
}
62
63
 
 
64
// Merge merges two branches and returns the path to the merged source.
 
65
func (handler *BzrHandler) Merge(source string, target string) (string, error) {
 
66
        path, err := handler.Get(target)
 
67
        if err == nil {
 
68
                log.Printf("*** Merging %s with %s ***", target, source)
 
69
                params := utils.NewExecCommandParams(path, []string{"bzr", "merge", source}, true)
 
70
                _, err = handler.util.ExecCommand(params)
 
71
        }
 
72
        return path, err
 
73
}
 
74
 
63
75
// NewBzrHandler returns a pointer to a new bzr source handler
64
76
func NewBzrHandler(util utils.Utilizer) *BzrHandler {
65
77
        return &BzrHandler{util: util}