From 24f80a9b9870ea9328fdca0bb11b12c0708bae84 Mon Sep 17 00:00:00 2001 From: Joel Reed Date: Fri, 20 Jul 2007 12:54:13 -0400 Subject: [PATCH] fix.get.multiple.paths --- tools/tf/GetCommand.cs | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/tools/tf/GetCommand.cs b/tools/tf/GetCommand.cs index de6baa0..eacee09 100644 --- a/tools/tf/GetCommand.cs +++ b/tools/tf/GetCommand.cs @@ -88,23 +88,35 @@ class GetCommand : Command return getOptions; } - public GetStatus UpdatePathFromServer(string path, RecursionType rtype) + public GetStatus UpdatePathFromServer(string[] paths) { - if (path[0] != '$') path = Path.GetFullPath(path); - GetRequest request = new GetRequest(path, rtype, VersionFromString(OptionVersion)); - return workspace.Get(request, GetOptionFlags()); + // process command options + RecursionType folderRecursion = OptionRecursive ? RecursionType.Full : RecursionType.OneLevel; + bool getSetting = Settings.Current.GetAsBool("Get.Recursive"); + if (getSetting) folderRecursion = RecursionType.Full; + + VersionSpec version = VersionFromString(OptionVersion); + List requests = new List(); + + foreach (string path in paths) + { + RecursionType recursion = RecursionType.None; + if (Directory.Exists(path)) recursion = folderRecursion; + + if (path[0] != '$') + requests.Add(new GetRequest(Path.GetFullPath(path), recursion, version)); + else + requests.Add(new GetRequest(path, recursion, version)); + } + + return workspace.Get(requests.ToArray(), GetOptionFlags()); } public override void Run() { - // process command options - RecursionType rtype = OptionRecursive ? RecursionType.Full : RecursionType.None; - bool getSetting = Settings.Current.GetAsBool("Get.Recursive"); - if (getSetting) rtype = RecursionType.Full; - GetStatus status; if (Arguments.Length > 0) - status = UpdatePathFromServer(Arguments[0], rtype); + status = UpdatePathFromServer(Arguments); else status = workspace.Get(VersionFromString(OptionVersion), GetOptionFlags()); -- 2.11.4.GIT