Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Add ability to include/exclude changes #101

Merged
merged 2 commits into from
Feb 13, 2017
Merged

Conversation

jeffyoung
Copy link
Contributor

Also provided Refresh in context menu
Removed ExcludeAll/IncludeAll

Also provided Refresh in context menu
Removed ExcludeAll/IncludeAll
src/extension.ts Outdated
context.subscriptions.push(commands.registerCommand(TfvcCommandNames.IncludeAll, () => _extensionManager.Tfvc.TfvcIncludeAll()));
}));
context.subscriptions.push(commands.registerCommand(TfvcCommandNames.Exclude, (...args) => {
if (args) {
Copy link
Member

Choose a reason for hiding this comment

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

Since most commands will need this logic, it would be nice to somehow push this into a helper method. Not sure if that is easy or not.

let line: string = lines[index];
if (this.isFilePath(line)) {
path = line;
} else if (line) {
Copy link
Member

Choose a reason for hiding this comment

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

line can't be empty here since you excluded them in the split above.

//At this point, an unversioned file could be a candidate file, so call Add. Once it is added, it should be a Pending change.
if (!resource.IsVersioned) {
await this._repo.Add([path]);
//Even if adding a file, Unexclude it (it may have been excluded previously)
Copy link
Member

Choose a reason for hiding this comment

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

The comments are a bit confusing. Looks like you used to have an else clause here and then removed it.

};

public static async Refresh(): Promise<void> {
const tfvcProvider: TfvcSCMProvider = TfvcSCMProvider.instance;
Copy link
Member

Choose a reason for hiding this comment

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

looks like we are reusing this invalid state check a lot. Consider refactoring it into it's own method that gets the scm provider.

//Add the item to the explicitly excluded list.
public async Exclude(path: string): Promise<void> {
if (path) {
if (!_.contains(this._explicitlyExcluded, path)) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this contains case insensitive? It probably should be.

//Unexclude doesn't explicitly INclude. It defers to the status of the individual item.
public async Unexclude(path: string): Promise<void> {
if (path) {
if (_.contains(this._explicitlyExcluded, path)) {
Copy link
Member

Choose a reason for hiding this comment

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

Case insensitive?

Copy link
Member

@jpricket jpricket left a comment

Choose a reason for hiding this comment

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

A few comments, but nothing that's a real problem.

@jeffyoung jeffyoung merged commit 7c82235 into master Feb 13, 2017
@jeffyoung jeffyoung deleted the jeyou/include-exclude branch February 13, 2017 22:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants