Merged
Conversation
technoweenie
reviewed
Dec 5, 2017
tq/meter.go
Outdated
| } | ||
|
|
||
| // NewMeter creates a new Meter. | ||
| func NewMeter(opt *MeterOption) *Meter { |
Contributor
There was a problem hiding this comment.
Do we really need the MeterOption type? The only two things to change are whether dry run is enabled, and what logger is used.
m := NewMeter()
m.DryRun = true
m.Logger = tq.LoggerToFile(filename)
m.Logger = tq.LoggerFromEnv(osEnv)
m.Start()My hunch is that we didn't use fields like this to prevent race conditions. Should we continue trying to protect the caller, or can we simplify things and just document that those fields should be set before Start() is called? FWIW I do prefer the MeterOptions type to the option func args 👍
tq/meter.go
Outdated
|
|
||
| // Start begins sending status updates to the optional log file, and stdout. | ||
| func (p *ProgressMeter) Start() { | ||
| func (p *Meter) Start() { |
Contributor
There was a problem hiding this comment.
Super nitpick: Can you change this to m *Meter?
Contributor
|
I made the suggested fixes so I could see if it worked in #2774. If you really want to keep |
Contributor
Author
|
Those changes look great, thanks! |
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
In PR git-lfs#2757 the output of the "git lfs prune" command was revised to use the methods of the Logger structure of the "tasklog" package to output progress messages, replacing use of the Spinner structure from the older "progress" package. The Spinner structure and its methods were then removed in PR git-lfs#2759, and the "progress" package was removed entirely in PR git-lfs#2762. As part of this change, the "git lfs prune" command's progress messages were reformatted so as to always begin with the Git LFS subcommand name, for example, "prune: 8 local objects, 9 retained, done." Two other Git LFS commands follow the same design, the "git lfs fetch" and "git lfs migrate" commands, but no others. Git commands also do not prefix their progress messages with the name of the subcommand (although messages from a Git remote may be reported with the prefix "remote:"). To help bring all our commands' progress messages into alignment, we simply remove the "prune:" prefix from the messages output by the "git lfs prune" command. We expect to revise the progress messages from the "git lfs fetch" and "git lfs migrate" commands in the same way in subsequent commits of this PR.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
In PR git-lfs#2758 the output of the "git lfs fetch" command was revised to use the methods of the Logger structure of the "tasklog" package to output progress messages, replacing use of the Spinner structure from the older "progress" package. The Spinner structure and its methods were then removed in PR git-lfs#2759, and the "progress" package was removed entirely in PR git-lfs#2762. As part of this change, the "git lfs fetch" command's progress messages were reformatted so as to always begin with the Git LFS subcommand name, for example, "fetch: Fetching reference refs/heads/main". Two other Git LFS commands follow the same design, the "git lfs prune" and "git lfs migrate" commands, but no others. Git commands also do not prefix their progress messages with the name of the subcommand (although messages from a Git remote may be reported with the prefix "remote:"). To help bring all our commands' progress messages into alignment, we simply remove the "fetch:" prefix from the messages output by the "git lfs fetch" command. We have similarly altered the progress messages of the "git lfs prune" command in a previous commit in this PR, and we expect to revise the progress messages from the "git lfs migrate" command in the same way in a subsequent commit in this PR.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
In PR git-lfs#2757 the output of the "git lfs prune" command was revised to use the methods of the Logger structure of the "tasklog" package to output progress messages, replacing use of the Spinner structure from the older "progress" package. The Spinner structure and its methods were then removed in PR git-lfs#2759, and the "progress" package was removed entirely in PR git-lfs#2762. As part of this change, the "git lfs prune" command's progress messages were reformatted so as to always begin with the Git LFS subcommand name, for example, "prune: 8 local objects, 9 retained, done." Two other Git LFS commands follow the same design, the "git lfs fetch" and "git lfs migrate" commands, but no others. Git commands also do not prefix their progress messages with the name of the subcommand (although messages from a Git remote may be reported with the prefix "remote:"). To help bring all our commands' progress messages into alignment, we simply remove the "prune:" prefix from the messages output by the "git lfs prune" command. We expect to revise the progress messages from the "git lfs fetch" and "git lfs migrate" commands in the same way in subsequent commits of this PR.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
In PR git-lfs#2758 the output of the "git lfs fetch" command was revised to use the methods of the Logger structure of the "tasklog" package to output progress messages, replacing use of the Spinner structure from the older "progress" package. The Spinner structure and its methods were then removed in PR git-lfs#2759, and the "progress" package was removed entirely in PR git-lfs#2762. As part of this change, the "git lfs fetch" command's progress messages were reformatted so as to always begin with the Git LFS subcommand name, for example, "fetch: Fetching reference refs/heads/main". Two other Git LFS commands follow the same design, the "git lfs prune" and "git lfs migrate" commands, but no others. Git commands also do not prefix their progress messages with the name of the subcommand (although messages from a Git remote may be reported with the prefix "remote:"). To help bring all our commands' progress messages into alignment, we simply remove the "fetch:" prefix from the messages output by the "git lfs fetch" command. We have similarly altered the progress messages of the "git lfs prune" command in a previous commit in this PR, and we expect to revise the progress messages from the "git lfs migrate" command in the same way in a subsequent commit in this PR.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
In PR git-lfs#2757 the output of the "git lfs prune" command was revised to use the methods of the Logger structure of the "tasklog" package to output progress messages, replacing use of the Spinner structure from the older "progress" package. The Spinner structure and its methods were then removed in PR git-lfs#2759, and the "progress" package was removed entirely in PR git-lfs#2762. As part of this change, the "git lfs prune" command's progress messages were reformatted so as to always begin with the Git LFS subcommand name, for example, "prune: 8 local objects, 9 retained, done." Two other Git LFS commands follow the same design, the "git lfs fetch" and "git lfs migrate" commands, but no others. Git commands also do not prefix their progress messages with the name of the subcommand (although messages from a Git remote may be reported with the prefix "remote:"). To help bring all our commands' progress messages into alignment, we simply remove the "prune:" prefix from the messages output by the "git lfs prune" command. We expect to revise the progress messages from the "git lfs fetch" and "git lfs migrate" commands in the same way in subsequent commits of this PR.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
In PR git-lfs#2758 the output of the "git lfs fetch" command was revised to use the methods of the Logger structure of the "tasklog" package to output progress messages, replacing use of the Spinner structure from the older "progress" package. The Spinner structure and its methods were then removed in PR git-lfs#2759, and the "progress" package was removed entirely in PR git-lfs#2762. As part of this change, the "git lfs fetch" command's progress messages were reformatted so as to always begin with the Git LFS subcommand name, for example, "fetch: Fetching reference refs/heads/main". Two other Git LFS commands follow the same design, the "git lfs prune" and "git lfs migrate" commands, but no others. Git commands also do not prefix their progress messages with the name of the subcommand (although messages from a Git remote may be reported with the prefix "remote:"). To help bring all our commands' progress messages into alignment, we simply remove the "fetch:" prefix from the messages output by the "git lfs fetch" command. We have similarly altered the progress messages of the "git lfs prune" command in a previous commit in this PR, and we expect to revise the progress messages from the "git lfs migrate" command in the same way in a subsequent commit in this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request does the scaffolding necessary to, and removes the
*progress.Meterimplementation from packageprogress.My initial approach with this branch was to copy verbatim the
*progress.ProgressMetertype fromprogressto packagetq. This worked fine, but I noticed that it expanded packagetq's API significantly, with the majority of API changes coming fromprogress.DryRun,progress.WithOSEnv, (etc) options. To mitigate this, my first inclination was to create a sub-packagetq/progress, which would house these types/functions. Wanting not to create a new package, I removed the progress meter option functions in favor of an options struct, and moved that into thetqpackage directly.Here's a quick breakdown of what happened:
progress-remove-loggerto avoid a merge conflict later when merging this branch into master.*ProgressMeterto respond to thenil-receiver, to make it possible to removeprogress.Noop(), and instead use(nil)(*progress.Meter).progress.Noop().*ProgressMeteris the only remaining implementation ofprogress.Meter, remove theprogress.Meterinterface.*progress.ProgressMeter->*progress.Meterto avoid stuttering.*progress.Meter-related API, remove option functions in favor of a struct-style instantiation, i,e.,*progress.Meterto*tq.Meter, thus enabling theprogresspackage to be removed./cc @git-lfs/core