Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Conversation

endophage
Copy link
Contributor

@endophage endophage commented Jul 20, 2016

Needs tests

Partially addresses #596

Adds --reset and --unstage flags to notary status. reset removes all pending changes for the GUN, unstage allows specific changes to be removed based on their # as shown in notary status

Signed-off-by: David Lawrence [email protected] (github: endophage)

@riyazdf
Copy link
Contributor

riyazdf commented Jul 22, 2016

Seems like the reset flag in here should address #866 (at least on the notary side)


cmd.AddCommand(cmdTUFStatusTemplate.ToCommand(t.tufStatus))
cmdStatus := cmdTUFStatusTemplate.ToCommand(t.tufStatus)
cmdStatus.Flags().IntSliceVarP(&t.changes, "unstage", "u", nil, "Numbers of changes to delete, as show in status list")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/show/shown

@riyazdf
Copy link
Contributor

riyazdf commented Jul 25, 2016

took this out for a spin and the functionality is great! Just a couple of small nits, can't wait for when tests are ready :)

if err != nil {
return err
}
sort.Sort(fileChanges(fileInfos))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we factor out the first few lines of this function and List into a helper for getting back a sorted list of []os.FileInfo?

Copy link
Contributor Author

@endophage endophage Jul 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just make list and the iterator getFileNames return in a deterministic (sorted) order

David Lawrence added 2 commits August 1, 2016 10:36
Signed-off-by: David Lawrence <[email protected]> (github: endophage)
…change can't be applied before aborting

Signed-off-by: David Lawrence <[email protected]> (github: endophage)
@endophage endophage changed the title WIP: update to allow removing pending changes update to allow removing pending changes Aug 1, 2016
}

// Remove deletes the changes found at the given indices
func (cl *memChangelist) Remove(idxs []int) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for this method? I think the cmd functions only use file changelists which is why it isn't covered

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Signed-off-by: David Lawrence <[email protected]> (github: endophage)
@riyazdf
Copy link
Contributor

riyazdf commented Aug 1, 2016

LGTM pending CI

}

cmd.Printf("Unpublished changes for %s:\n\n", gun)
cmd.Printf("%-10s%-10s%-12s%s\n", "action", "scope", "type", "path")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for fixing this formatting! It looks much nicer!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big fan of tabwriter now that I've discovered it :-)

@cyli
Copy link
Contributor

cyli commented Aug 1, 2016

LGTM pending CI!

@endophage endophage merged commit 49462f6 into notaryproject:master Aug 1, 2016
@endophage endophage deleted the status_management branch August 1, 2016 22:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants