Merge pull request #2747 from git-lfs/make-log-top-level
*: introduce package 'tlog'
This commit is contained in:
commit
d4f39aef4c
@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/filepathfilter"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/lfs"
|
||||
"github.com/git-lfs/git-lfs/progress"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -27,7 +27,7 @@ func checkoutCommand(cmd *cobra.Command, args []string) {
|
||||
|
||||
var totalBytes int64
|
||||
var pointers []*lfs.WrappedPointer
|
||||
logger := log.NewLogger(os.Stdout)
|
||||
logger := tasklog.NewLogger(os.Stdout)
|
||||
meter := progress.NewMeter(progress.WithOSEnv(cfg.Os))
|
||||
logger.Enqueue(meter)
|
||||
chgitscanner := lfs.NewGitScanner(func(p *lfs.WrappedPointer, err error) {
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/filepathfilter"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/lfs"
|
||||
"github.com/git-lfs/git-lfs/progress"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tq"
|
||||
"github.com/rubyist/tracerx"
|
||||
"github.com/spf13/cobra"
|
||||
@ -229,7 +229,7 @@ func fetchAll() bool {
|
||||
func scanAll() []*lfs.WrappedPointer {
|
||||
// This could be a long process so use the chan version & report progress
|
||||
Print("Scanning for all objects ever referenced...")
|
||||
logger := log.NewLogger(OutputWriter)
|
||||
logger := tasklog.NewLogger(OutputWriter)
|
||||
spinner := progress.NewSpinner()
|
||||
logger.Enqueue(spinner)
|
||||
var numObjs int64
|
||||
@ -325,7 +325,7 @@ func fetchAndReportToChan(allpointers []*lfs.WrappedPointer, filter *filepathfil
|
||||
}
|
||||
|
||||
func readyAndMissingPointers(allpointers []*lfs.WrappedPointer, filter *filepathfilter.Filter) ([]*lfs.WrappedPointer, []*lfs.WrappedPointer, *progress.ProgressMeter) {
|
||||
logger := log.NewLogger(os.Stdout)
|
||||
logger := tasklog.NewLogger(os.Stdout)
|
||||
meter := buildProgressMeter(false)
|
||||
logger.Enqueue(meter)
|
||||
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"github.com/git-lfs/git-lfs/errors"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/git/odb"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -36,7 +36,7 @@ var (
|
||||
|
||||
// migrate takes the given command and arguments, *odb.ObjectDatabase, as well
|
||||
// as a BlobRewriteFn to apply, and performs a migration.
|
||||
func migrate(args []string, r *githistory.Rewriter, l *log.Logger, opts *githistory.RewriteOptions) {
|
||||
func migrate(args []string, r *githistory.Rewriter, l *tasklog.Logger, opts *githistory.RewriteOptions) {
|
||||
requireInRepo()
|
||||
|
||||
opts, err := rewriteOptions(args, opts, l)
|
||||
@ -73,7 +73,7 @@ func getObjectDatabase() (*odb.ObjectDatabase, error) {
|
||||
//
|
||||
// If any of the above could not be determined without error, that error will be
|
||||
// returned immediately.
|
||||
func rewriteOptions(args []string, opts *githistory.RewriteOptions, l *log.Logger) (*githistory.RewriteOptions, error) {
|
||||
func rewriteOptions(args []string, opts *githistory.RewriteOptions, l *tasklog.Logger) (*githistory.RewriteOptions, error) {
|
||||
include, exclude, err := includeExcludeRefs(l, args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -102,7 +102,7 @@ func rewriteOptions(args []string, opts *githistory.RewriteOptions, l *log.Logge
|
||||
// arguments and the --include-ref= or --exclude-ref= flag(s) aren't given.
|
||||
// - Include all references given in --include-ref=<ref>.
|
||||
// - Exclude all references given in --exclude-ref=<ref>.
|
||||
func includeExcludeRefs(l *log.Logger, args []string) (include, exclude []string, err error) {
|
||||
func includeExcludeRefs(l *tasklog.Logger, args []string) (include, exclude []string, err error) {
|
||||
hardcore := len(migrateIncludeRefs) > 0 || len(migrateExcludeRefs) > 0
|
||||
|
||||
if len(args) == 0 && !hardcore && !migrateEverything {
|
||||
@ -171,7 +171,7 @@ func includeExcludeRefs(l *log.Logger, args []string) (include, exclude []string
|
||||
// getRemoteRefs returns a fully qualified set of references belonging to all
|
||||
// remotes known by the currently checked-out repository, or an error if those
|
||||
// references could not be determined.
|
||||
func getRemoteRefs(l *log.Logger) ([]*git.Ref, error) {
|
||||
func getRemoteRefs(l *tasklog.Logger) ([]*git.Ref, error) {
|
||||
var refs []*git.Ref
|
||||
|
||||
remotes, err := git.RemoteList()
|
||||
@ -248,7 +248,7 @@ func currentRefToMigrate() (*git.Ref, error) {
|
||||
|
||||
// getHistoryRewriter returns a history rewriter that includes the filepath
|
||||
// filter given by the --include and --exclude arguments.
|
||||
func getHistoryRewriter(cmd *cobra.Command, db *odb.ObjectDatabase, l *log.Logger) *githistory.Rewriter {
|
||||
func getHistoryRewriter(cmd *cobra.Command, db *odb.ObjectDatabase, l *tasklog.Logger) *githistory.Rewriter {
|
||||
include, exclude := getIncludeExcludeArgs(cmd)
|
||||
filter := buildFilepathFilter(cfg, include, exclude)
|
||||
|
||||
|
@ -12,15 +12,15 @@ import (
|
||||
"github.com/git-lfs/git-lfs/filepathfilter"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/git/odb"
|
||||
"github.com/git-lfs/git-lfs/lfs"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tools"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func migrateImportCommand(cmd *cobra.Command, args []string) {
|
||||
l := log.NewLogger(os.Stderr)
|
||||
l := tasklog.NewLogger(os.Stderr)
|
||||
defer l.Close()
|
||||
|
||||
db, err := getObjectDatabase()
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/errors"
|
||||
"github.com/git-lfs/git-lfs/git/githistory"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/git/odb"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tools"
|
||||
"github.com/git-lfs/git-lfs/tools/humanize"
|
||||
"github.com/spf13/cobra"
|
||||
@ -40,7 +40,7 @@ var (
|
||||
)
|
||||
|
||||
func migrateInfoCommand(cmd *cobra.Command, args []string) {
|
||||
l := log.NewLogger(os.Stderr)
|
||||
l := tasklog.NewLogger(os.Stderr)
|
||||
|
||||
db, err := getObjectDatabase()
|
||||
if err != nil {
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/fs"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/lfs"
|
||||
"github.com/git-lfs/git-lfs/progress"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tools"
|
||||
"github.com/git-lfs/git-lfs/tools/humanize"
|
||||
"github.com/git-lfs/git-lfs/tq"
|
||||
@ -57,7 +57,7 @@ func prune(fetchPruneConfig lfs.FetchPruneConfig, verifyRemote, dryRun, verbose
|
||||
localObjects := make([]fs.Object, 0, 100)
|
||||
retainedObjects := tools.NewStringSetWithCapacity(100)
|
||||
|
||||
logger := log.NewLogger(OutputWriter)
|
||||
logger := tasklog.NewLogger(OutputWriter)
|
||||
spinner := progress.NewSpinner()
|
||||
logger.Enqueue(spinner)
|
||||
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/filepathfilter"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/lfs"
|
||||
"github.com/git-lfs/git-lfs/progress"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tq"
|
||||
"github.com/rubyist/tracerx"
|
||||
"github.com/spf13/cobra"
|
||||
@ -39,7 +39,7 @@ func pull(filter *filepathfilter.Filter) {
|
||||
}
|
||||
|
||||
pointers := newPointerMap()
|
||||
logger := log.NewLogger(os.Stdout)
|
||||
logger := tasklog.NewLogger(os.Stdout)
|
||||
meter := progress.NewMeter(progress.WithOSEnv(cfg.Os))
|
||||
logger.Enqueue(meter)
|
||||
remote := cfg.Remote()
|
||||
|
@ -11,9 +11,9 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/git-lfs/git-lfs/errors"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/lfs"
|
||||
"github.com/git-lfs/git-lfs/progress"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tools"
|
||||
"github.com/git-lfs/git-lfs/tq"
|
||||
"github.com/rubyist/tracerx"
|
||||
@ -57,7 +57,7 @@ type uploadContext struct {
|
||||
uploadedOids tools.StringSet
|
||||
gitfilter *lfs.GitFilter
|
||||
|
||||
logger *log.Logger
|
||||
logger *tasklog.Logger
|
||||
meter progress.Meter
|
||||
tq *tq.TransferQueue
|
||||
|
||||
@ -93,7 +93,7 @@ func newUploadContext(dryRun bool) *uploadContext {
|
||||
sink = ioutil.Discard
|
||||
}
|
||||
|
||||
ctx.logger = log.NewLogger(sink)
|
||||
ctx.logger = tasklog.NewLogger(sink)
|
||||
ctx.meter = buildProgressMeter(ctx.DryRun)
|
||||
ctx.logger.Enqueue(ctx.meter)
|
||||
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/errors"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tools"
|
||||
)
|
||||
|
||||
@ -19,7 +19,7 @@ type refUpdater struct {
|
||||
// signaling whether or not that given "old" SHA1 was migrated.
|
||||
CacheFn func(old []byte) ([]byte, bool)
|
||||
// Logger logs the progress of reference updating.
|
||||
Logger *log.Logger
|
||||
Logger *tasklog.Logger
|
||||
// Refs is a set of *git.Ref's to migrate.
|
||||
Refs []*git.Ref
|
||||
// Root is the given directory on disk in which the repository is
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"github.com/git-lfs/git-lfs/errors"
|
||||
"github.com/git-lfs/git-lfs/filepathfilter"
|
||||
"github.com/git-lfs/git-lfs/git"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/git/odb"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
)
|
||||
|
||||
// Rewriter allows rewriting topologically equivalent Git histories
|
||||
@ -34,8 +34,8 @@ type Rewriter struct {
|
||||
// db is the *ObjectDatabase from which blobs, commits, and trees are
|
||||
// loaded from.
|
||||
db *odb.ObjectDatabase
|
||||
// l is the *log.Logger to which updates are written.
|
||||
l *log.Logger
|
||||
// l is the *tasklog.Logger to which updates are written.
|
||||
l *tasklog.Logger
|
||||
}
|
||||
|
||||
// RewriteOptions is an options type given to the Rewrite() function.
|
||||
@ -133,12 +133,12 @@ var (
|
||||
// WithLoggerto logs updates caused by the *git/githistory.Rewriter to
|
||||
// the given io.Writer "sink".
|
||||
WithLoggerTo = func(sink io.Writer) rewriterOption {
|
||||
return WithLogger(log.NewLogger(sink))
|
||||
return WithLogger(tasklog.NewLogger(sink))
|
||||
}
|
||||
|
||||
// WithLogger logs updates caused by the *git/githistory.Rewriter to the
|
||||
// be given to the provided logger, "l".
|
||||
WithLogger = func(l *log.Logger) rewriterOption {
|
||||
WithLogger = func(l *tasklog.Logger) rewriterOption {
|
||||
return func(r *Rewriter) {
|
||||
r.l = l
|
||||
}
|
||||
@ -177,14 +177,14 @@ func (r *Rewriter) Rewrite(opt *RewriteOptions) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var perc *log.PercentageTask
|
||||
var perc *tasklog.PercentageTask
|
||||
if opt.UpdateRefs {
|
||||
perc = r.l.Percentage("migrate: Rewriting commits", uint64(len(commits)))
|
||||
} else {
|
||||
perc = r.l.Percentage("migrate: Examining commits", uint64(len(commits)))
|
||||
}
|
||||
|
||||
var vPerc *log.PercentageTask
|
||||
var vPerc *tasklog.PercentageTask
|
||||
if opt.Verbose {
|
||||
vPerc = perc
|
||||
}
|
||||
@ -301,7 +301,7 @@ func (r *Rewriter) Rewrite(opt *RewriteOptions) ([]byte, error) {
|
||||
//
|
||||
// It returns the new SHA of the rewritten tree, or an error if the tree was
|
||||
// unable to be rewritten.
|
||||
func (r *Rewriter) rewriteTree(commitOID []byte, treeOID []byte, path string, fn BlobRewriteFn, tfn TreeCallbackFn, perc *log.PercentageTask) ([]byte, error) {
|
||||
func (r *Rewriter) rewriteTree(commitOID []byte, treeOID []byte, path string, fn BlobRewriteFn, tfn TreeCallbackFn, perc *tasklog.PercentageTask) ([]byte, error) {
|
||||
tree, err := r.db.Tree(treeOID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -371,7 +371,7 @@ func (r *Rewriter) allows(typ odb.ObjectType, abs string) bool {
|
||||
// database by the SHA1 "from" []byte. It writes and returns the new blob SHA,
|
||||
// or an error if either the BlobRewriteFn returned one, or if the object could
|
||||
// not be loaded/saved.
|
||||
func (r *Rewriter) rewriteBlob(commitOID, from []byte, path string, fn BlobRewriteFn, perc *log.PercentageTask) ([]byte, error) {
|
||||
func (r *Rewriter) rewriteBlob(commitOID, from []byte, path string, fn BlobRewriteFn, perc *tasklog.PercentageTask) ([]byte, error) {
|
||||
blob, err := r.db.Blob(from)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/tools/humanize"
|
||||
)
|
||||
|
||||
@ -29,7 +29,7 @@ type ProgressMeter struct {
|
||||
fileIndex map[string]int64 // Maps a file name to its transfer number
|
||||
fileIndexMutex *sync.Mutex
|
||||
dryRun bool
|
||||
updates chan *log.Update
|
||||
updates chan *tasklog.Update
|
||||
}
|
||||
|
||||
type env interface {
|
||||
@ -92,7 +92,7 @@ func NewMeter(options ...meterOption) *ProgressMeter {
|
||||
logger: &progressLogger{},
|
||||
fileIndex: make(map[string]int64),
|
||||
fileIndexMutex: &sync.Mutex{},
|
||||
updates: make(chan *log.Update),
|
||||
updates: make(chan *tasklog.Update),
|
||||
}
|
||||
|
||||
for _, opt := range options {
|
||||
@ -164,7 +164,7 @@ func (p *ProgressMeter) Finish() {
|
||||
close(p.updates)
|
||||
}
|
||||
|
||||
func (p *ProgressMeter) Updates() <-chan *log.Update {
|
||||
func (p *ProgressMeter) Updates() <-chan *tasklog.Update {
|
||||
return p.updates
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ func (p *ProgressMeter) update() {
|
||||
return
|
||||
}
|
||||
|
||||
p.updates <- &log.Update{
|
||||
p.updates <- &tasklog.Update{
|
||||
S: p.str(),
|
||||
At: time.Now(),
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package progress
|
||||
|
||||
import "github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
import "github.com/git-lfs/git-lfs/tasklog"
|
||||
|
||||
func Noop() Meter {
|
||||
return &nonMeter{
|
||||
updates: make(chan *log.Update),
|
||||
updates: make(chan *tasklog.Update),
|
||||
}
|
||||
}
|
||||
|
||||
type nonMeter struct {
|
||||
updates chan *log.Update
|
||||
updates chan *tasklog.Update
|
||||
}
|
||||
|
||||
func (m *nonMeter) Start() {}
|
||||
@ -23,5 +23,5 @@ func (m *nonMeter) Finish() {
|
||||
close(m.updates)
|
||||
}
|
||||
|
||||
func (m *nonMeter) Updates() <-chan *log.Update { return m.updates }
|
||||
func (m *nonMeter) Throttled() bool { return false }
|
||||
func (m *nonMeter) Updates() <-chan *tasklog.Update { return m.updates }
|
||||
func (m *nonMeter) Throttled() bool { return false }
|
||||
|
@ -2,10 +2,10 @@
|
||||
// NOTE: Subject to change, do not rely on this package from outside git-lfs source
|
||||
package progress
|
||||
|
||||
import "github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
import "github.com/git-lfs/git-lfs/tasklog"
|
||||
|
||||
type Meter interface {
|
||||
log.Task
|
||||
tasklog.Task
|
||||
|
||||
Start()
|
||||
Pause()
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
)
|
||||
|
||||
// Indeterminate progress indicator 'spinner'
|
||||
@ -13,18 +13,18 @@ type Spinner struct {
|
||||
stage int
|
||||
msg string
|
||||
|
||||
updates chan *log.Update
|
||||
updates chan *tasklog.Update
|
||||
}
|
||||
|
||||
var spinnerChars = []byte{'|', '/', '-', '\\'}
|
||||
|
||||
func NewSpinner() *Spinner {
|
||||
return &Spinner{
|
||||
updates: make(chan *log.Update),
|
||||
updates: make(chan *tasklog.Update),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Spinner) Updates() <-chan *log.Update {
|
||||
func (s *Spinner) Updates() <-chan *tasklog.Update {
|
||||
return s.updates
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ func (s *Spinner) spin(msg string) {
|
||||
}
|
||||
|
||||
func (s *Spinner) update(sym, msg string) {
|
||||
s.updates <- &log.Update{
|
||||
s.updates <- &tasklog.Update{
|
||||
S: fmt.Sprintf("%s %s", sym, msg),
|
||||
At: time.Now(),
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -14,9 +14,9 @@ func TestListTaskCallsDoneWhenComplete(t *testing.T) {
|
||||
case update, ok := <-task.Updates():
|
||||
assert.Equal(t, "example: ...", update.S)
|
||||
assert.True(t, ok,
|
||||
"git/githistory/log: expected Updates() to remain open")
|
||||
"tasklog: expected Updates() to remain open")
|
||||
default:
|
||||
t.Fatal("git/githistory/log: expected update from *ListTask")
|
||||
t.Fatal("tasklog: expected update from *ListTask")
|
||||
}
|
||||
|
||||
select {
|
||||
@ -24,7 +24,7 @@ func TestListTaskCallsDoneWhenComplete(t *testing.T) {
|
||||
assert.False(t, ok,
|
||||
"git/githistory.log: unexpected *ListTask.Update(): %s", update)
|
||||
default:
|
||||
t.Fatal("git/githistory/log: expected *ListTask.Updates() to be closed")
|
||||
t.Fatal("tasklog: expected *ListTask.Updates() to be closed")
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,10 +35,10 @@ func TestListTaskWritesEntries(t *testing.T) {
|
||||
select {
|
||||
case update, ok := <-task.Updates():
|
||||
assert.True(t, ok,
|
||||
"git/githistory/log: expected ListTask.Updates() to remain open")
|
||||
"tasklog: expected ListTask.Updates() to remain open")
|
||||
assert.Equal(t, "1\n", update.S)
|
||||
default:
|
||||
t.Fatal("git/githistory/log: expected task.Updates() to have an update")
|
||||
t.Fatal("tasklog: expected task.Updates() to have an update")
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,5 +48,5 @@ func TestListTaskIsNotThrottled(t *testing.T) {
|
||||
throttled := task.Throttled()
|
||||
|
||||
assert.False(t, throttled,
|
||||
"git/githistory/log: expected *ListTask to be Throttle()-d")
|
||||
"tasklog: expected *ListTask to be Throttle()-d")
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -187,8 +187,8 @@ func (l *Logger) consume() {
|
||||
// of time specified by `l.throttle time.Duration`.
|
||||
//
|
||||
// If the duration if 0, or the task is "durable" (by implementing
|
||||
// github.com/git-lfs/git-lfs/git/githistory/log#DurableTask), then all entries
|
||||
// will be logged.
|
||||
// github.com/git-lfs/git-lfs/tasklog#DurableTask), then all entries will be
|
||||
// logged.
|
||||
func (l *Logger) logTask(task Task) {
|
||||
defer l.wg.Done()
|
||||
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -41,7 +41,7 @@ func NewPercentageTask(msg string, total uint64) *PercentageTask {
|
||||
// been completed.
|
||||
func (c *PercentageTask) Count(n uint64) (new uint64) {
|
||||
if new = atomic.AddUint64(&c.n, n); new > c.total {
|
||||
panic("git/githistory/log: counted too many items")
|
||||
panic("tasklog: counted too many items")
|
||||
}
|
||||
|
||||
var percentage float64
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -58,13 +58,13 @@ func TestPercentageTaskIsThrottled(t *testing.T) {
|
||||
throttled := task.Throttled()
|
||||
|
||||
assert.True(t, throttled,
|
||||
"git/githistory/log: expected *PercentageTask to be Throttle()-d")
|
||||
"tasklog: expected *PercentageTask to be Throttle()-d")
|
||||
}
|
||||
|
||||
func TestPercentageTaskPanicsWhenOvercounted(t *testing.T) {
|
||||
task := NewPercentageTask("example", 0)
|
||||
defer func() {
|
||||
assert.Equal(t, "git/githistory/log: counted too many items", recover())
|
||||
assert.Equal(t, "tasklog: counted too many items", recover())
|
||||
}()
|
||||
|
||||
task.Count(1)
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import "time"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package log
|
||||
package tasklog
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -39,12 +39,12 @@ func TestWaitingTaskPanicsWithMultipleDoneCalls(t *testing.T) {
|
||||
|
||||
defer func() {
|
||||
if err := recover(); err == nil {
|
||||
t.Fatal("githistory/log: expected panic()")
|
||||
t.Fatal("tasklog: expected panic()")
|
||||
} else {
|
||||
if s, ok := err.(error); ok {
|
||||
assert.Equal(t, "close of closed channel", s.Error())
|
||||
} else {
|
||||
t.Fatal("githistory/log: expected panic() to implement error")
|
||||
t.Fatal("tasklog: expected panic() to implement error")
|
||||
}
|
||||
}
|
||||
}()
|
||||
@ -58,5 +58,5 @@ func TestWaitingTaskIsThrottled(t *testing.T) {
|
||||
throttled := task.Throttled()
|
||||
|
||||
assert.True(t, throttled,
|
||||
"git/githistory/log: expected *WaitingTask to be Throttle()-d")
|
||||
"tasklog: expected *WaitingTask to be Throttle()-d")
|
||||
}
|
@ -12,9 +12,9 @@ import (
|
||||
|
||||
"github.com/git-lfs/git-lfs/errors"
|
||||
"github.com/git-lfs/git-lfs/fs"
|
||||
"github.com/git-lfs/git-lfs/git/githistory/log"
|
||||
"github.com/git-lfs/git-lfs/lfsapi"
|
||||
"github.com/git-lfs/git-lfs/progress"
|
||||
"github.com/git-lfs/git-lfs/tasklog"
|
||||
"github.com/git-lfs/git-lfs/test"
|
||||
"github.com/git-lfs/git-lfs/tq"
|
||||
"github.com/spf13/cobra"
|
||||
@ -180,7 +180,7 @@ func buildTestData(repo *test.Repo, manifest *tq.Manifest) (oidsExist, oidsMissi
|
||||
oidsMissing = make([]TestObject, 0, oidCount)
|
||||
|
||||
// just one commit
|
||||
logger := log.NewLogger(os.Stdout)
|
||||
logger := tasklog.NewLogger(os.Stdout)
|
||||
meter := progress.NewMeter(progress.WithOSEnv(repo.OSEnv()))
|
||||
logger.Enqueue(meter)
|
||||
commit := test.CommitInput{CommitterName: "A N Other", CommitterEmail: "noone@somewhere.com"}
|
||||
|
Loading…
Reference in New Issue
Block a user