config/packages/tools/brig/vcs-mapper-debug-to-logger.patch

111 lines
3.2 KiB
Diff
Raw Normal View History

2022-06-17 23:27:15 +03:00
diff --git a/catfs/vcs/debug.go b/catfs/vcs/debug.go
deleted file mode 100644
index 18dbe736..00000000
--- a/catfs/vcs/debug.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package vcs
-
-import (
- "fmt"
-)
-
-const (
- printDebug = false
-)
-
-func debug(args ...interface{}) {
- if printDebug {
- fmt.Println(args...)
- }
-}
-
-func debugf(spec string, args ...interface{}) {
- if printDebug {
- fmt.Printf(spec, args...)
- }
-}
diff --git a/catfs/vcs/mapper.go b/catfs/vcs/mapper.go
index fb87116f..5568e600 100644
--- a/catfs/vcs/mapper.go
+++ b/catfs/vcs/mapper.go
@@ -138,7 +138,7 @@ func (ma *Mapper) report(src, dst n.ModNode, typeMismatch, isRemove, isMove bool
ma.setDstHandled(dst)
}
- debug("=> report", src, dst)
+ log.Debug("=> report", src, dst)
return ma.fn(MapPair{
Src: src,
Dst: dst,
@@ -181,7 +181,7 @@ func (ma *Mapper) mapFile(srcCurr *n.File, dstFilePath string) error {
return nil
}
- debug("map file", srcCurr.Path(), dstFilePath)
+ log.Debug("map file", srcCurr.Path(), dstFilePath)
// Remember that we visited this node.
ma.setSrcVisited(srcCurr)
@@ -669,9 +669,9 @@ func (ma *Mapper) extractLeftovers(lkr *c.Linker, root *n.Directory, srcToDst bo
}
for _, child := range children {
- debug(fmt.Sprintf("extract: %v", child.Path()))
+ log.Debug(fmt.Sprintf("extract: %v", child.Path()))
if ma.nodeIsHandled(child, srcToDst) {
- debug(fmt.Sprintf("node is handled: %v", child.Path()))
+ log.Debug(fmt.Sprintf("node is handled: %v", child.Path()))
continue
}
@@ -689,7 +689,7 @@ func (ma *Mapper) extractLeftovers(lkr *c.Linker, root *n.Directory, srcToDst bo
complete = ma.isDstComplete(dir)
}
- debug(fmt.Sprintf("is complete: %v %v", child.Path(), complete))
+ log.Debug(fmt.Sprintf("is complete: %v %v", child.Path(), complete))
if complete {
if srcToDst {
err = ma.report(dir, nil, false, false, false)
@@ -787,7 +787,7 @@ func (ma *Mapper) Map(fn func(pair MapPair) error) error {
if err != nil {
return err
}
- debug("-- Extract leftover src")
+ log.Debug("-- Extract leftover src")
// Extract things in "src" that were not mapped yet.
// These are files that can be added to our inventory,
@@ -795,7 +795,7 @@ func (ma *Mapper) Map(fn func(pair MapPair) error) error {
if err := ma.extractLeftovers(ma.lkrSrc, srcRoot, true); err != nil {
return err
}
- debug("-- Extract leftover dst")
+ log.Debug("-- Extract leftover dst")
// Check for files that we have, but dst does not.
// We call those files "missing".
diff --git a/catfs/vcs/resolve.go b/catfs/vcs/resolve.go
index 0f5e9cd6..14ca1f01 100644
--- a/catfs/vcs/resolve.go
+++ b/catfs/vcs/resolve.go
@@ -172,7 +172,7 @@ func (rv *resolver) cacheLastCommonMerge() error {
return err
}
- debugf("last merge found: %v = %s", with, srcRef)
+ log.Debugf("last merge found: %v = %s", with, srcRef)
rv.dstMergeCmt = currHead
rv.srcMergeCmt = srcHead
}
@@ -352,7 +352,7 @@ func (rv *resolver) decide(pair MapPair) error {
}
if pair.TypeMismatch {
- debugf(
+ log.Debugf(
"%s is a %s and %s a %s; ignoring",
pair.Src.Path(), pair.Src.Type(),
pair.Dst.Path(), pair.Dst.Type(),