From a330e1ee374a7770ff75ebb9ed685708dee1a544 Mon Sep 17 00:00:00 2001 From: "Joel W. Reed" Date: Wed, 22 Aug 2007 15:12:24 -0400 Subject: [PATCH] tf undo with no args will undo all local changes, previously the command required at least one filename or path --- ChangeLog | 2 ++ tools/tf/UndoCommand.cs | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c546fb6..3c23aba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ # NEW: add "explore" command for visually browsing a repository # NEW: add gtk login dialog for missing auth credentials + # NEW: tf undo with no args will undo all local changes, previously the command + required at least one filename or path # NEW: support for tf add /others # NEW: support wildcards in checkout paths # BUGFIX: when deleting directories, delete any files within them diff --git a/tools/tf/UndoCommand.cs b/tools/tf/UndoCommand.cs index 03da997..c30966b 100644 --- a/tools/tf/UndoCommand.cs +++ b/tools/tf/UndoCommand.cs @@ -46,14 +46,24 @@ class UndoCommand : Command public override void Run() { - ConfirmFilesSpecified(); - - List paths = new List(); - for (int i = 0; i < Arguments.Length; i++) - paths.Add(Path.GetFullPath(Arguments[i])); - RecursionType rtype = OptionRecursive ? RecursionType.Full : RecursionType.None; Workspace workspace = GetWorkspaceFromCache(); + List paths = new List(); + + if (Arguments.Length < 2) + { + PendingChange[] pendingChanges = workspace.GetPendingChanges(); + foreach (PendingChange pendingChange in pendingChanges) + { + paths.Add(pendingChange.LocalItem); + } + } + else + { + ConfirmFilesSpecified(); + for (int i = 0; i < Arguments.Length; i++) + paths.Add(Path.GetFullPath(Arguments[i])); + } int rc = workspace.Undo(paths.ToArray(), rtype); if (rc > 0) -- 2.11.4.GIT