/// <summary>
        /// Retrieves the latest changeset ID associated with a path
        /// </summary>
        /// <param name="localPath">A path on the local filesystem</param>
        /// <param name="credentials">Credentials used to authenticate against the serer</param>
        /// <returns></returns>
        public int GetLatestChangesetId(string localPath, ICredentials credentials)
        {
            int latestChangesetId = 0;
            string server;

            Workstation workstation = new Workstation(versionControlClientAssembly);
            WorkspaceInfo workspaceInfo = workstation.GetLocalWorkspaceInfo(localPath);
            server = workspaceInfo.ServerUri.ToString();
            VersionControlServer sourceControl = new VersionControlServer(clientAssembly, versionControlClientAssembly, server, credentials);

            Workspace workspace = sourceControl.GetWorkspace(localPath);
            WorkspaceVersionSpec workspaceVersionSpec = new WorkspaceVersionSpec(versionControlClientAssembly, workspace);

            VersionSpec versionSpec = new VersionSpec(versionControlClientAssembly);
            RecursionType recursionType = new RecursionType(versionControlClientAssembly);

            IEnumerable history = sourceControl.QueryHistory(localPath, versionSpec.Latest, recursionType.Full, workspaceVersionSpec);

            IEnumerator historyEnumerator = history.GetEnumerator();
            Changeset latestChangeset = new Changeset(versionControlClientAssembly);
            if (historyEnumerator.MoveNext())
            {
                latestChangeset = new Changeset(versionControlClientAssembly, historyEnumerator.Current);
            }

            if (latestChangeset.Instance != null)
            {
                latestChangesetId = latestChangeset.ChangesetId;
            }
            return latestChangesetId;
        }
        public IEnumerable QueryHistory(string localPath, VersionSpec version, RecursionType recursion, WorkspaceVersionSpec toVersion)
        {
            Type[] parameterTypes = new Type[] {
                        typeof(string), version.Type, typeof(int), recursion.Type, typeof(string), toVersion.Type, toVersion.Type, typeof(int), typeof(bool), typeof(bool) 
                    };

            MethodInfo queryHistoryMethod = _type.GetMethod("QueryHistory", parameterTypes);

            IEnumerable history = (IEnumerable)queryHistoryMethod.Invoke(_instance, 
                new object[] {
                    localPath, version.Instance, 0, recursion.Instance, null, null, toVersion.Instance, int.MaxValue, false, false
                });
            return history;
        }
Exemple #3
0
        public IEnumerable QueryHistory(string localPath, VersionSpec version, RecursionType recursion, WorkspaceVersionSpec toVersion)
        {
            Type[] parameterTypes = new Type[] {
                typeof(string), version.Type, typeof(int), recursion.Type, typeof(string), toVersion.Type, toVersion.Type, typeof(int), typeof(bool), typeof(bool)
            };

            MethodInfo queryHistoryMethod = _type.GetMethod("QueryHistory", parameterTypes);

            IEnumerable history = (IEnumerable)queryHistoryMethod.Invoke(_instance,
                                                                         new object[] {
                localPath, version.Instance, 0, recursion.Instance, null, null, toVersion.Instance, int.MaxValue, false, false
            });

            return(history);
        }