Example #1
0
 /// <summary>
 /// Add a file to the cache
 /// </summary>
 /// <param name="filePath"></param>
 public void AddToCache(string filePath)
 {
     _repo = filePath;
     try
     {
         if (_svnClient.GetStatus(_repo, new SvnStatusArgs
         {
             Depth = SvnDepth.Infinity,
             RetrieveAllEntries = true
         }, out var statusContents))
         {
             foreach (var content in statusContents)
             {
                 var contentStatusData = new SvnStatusData(content);
                 _statusCache.StoreItem(_statusCache.CreateItem(content.FullPath, contentStatusData));
                 var handler = SvnStatusUpdatedEvent;
                 handler?.Invoke(this, new SvnStatusUpdatedEventArgs(content.FullPath));
             }
         }
     }
     catch (Exception e)
     {
         //TODO: confirm this is ok
     }
 }
Example #2
0
        // Get Source Control one file info
        public override SourceControlFileInfo.eRepositoryItemStatus GetFileStatus(string Path, bool ShowIndicationkForLockedItems, ref string error)
        {
            if (Path == null || Path.Length == 0)
            {
                return(SourceControlFileInfo.eRepositoryItemStatus.Unknown);
            }

            if (client == null)
            {
                Init();
            }
            System.Collections.ObjectModel.Collection <SvnStatusEventArgs> statuses;
            try
            {
                int lastDotIndex = Path.LastIndexOf(".");
                if (lastDotIndex != -1 && Path.Substring(lastDotIndex).ToUpper() == ".XML" && ShowIndicationkForLockedItems)
                {
                    Collection <SvnListEventArgs> ListEventArgs;
                    Uri targetUri = GetRemoteUriFromPath(Path, out ListEventArgs);

                    if (ListEventArgs != null && ListEventArgs[0].Lock != null && ListEventArgs[0].Lock.Owner == SourceControlUser)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.LockedByMe);
                    }
                    else if (ListEventArgs != null && ListEventArgs[0].Lock != null && ListEventArgs[0].Lock.Owner != SourceControlUser)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.LockedByAnotherUser);
                    }
                }

                client.GetStatus(Path, out statuses);


                foreach (SvnStatusEventArgs arg in statuses)
                {
                    if (arg.LocalContentStatus == SvnStatus.Modified)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.Modified);
                    }
                    if (arg.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.New);
                    }
                    if (arg.LocalContentStatus == SvnStatus.Missing)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.Deleted);
                    }
                }

                return(SourceControlFileInfo.eRepositoryItemStatus.Equel);
            }
            catch (Exception ex)
            {
                error = ex.Message + Environment.NewLine + ex.InnerException;
                return(SourceControlFileInfo.eRepositoryItemStatus.New);
            }
        }
Example #3
0
        public static Collection <string> GetSvnChangedUri(string path)
        {
            var client   = new SvnClient();
            var statuses = new Collection <SvnStatusEventArgs>();
            Collection <string> result = new Collection <string>();

            try
            {
                bool bRetCode = client.GetStatus(path, out statuses);
                if (bRetCode)
                {
                    foreach (var item in statuses)
                    {
                        if (item.Uri != null)
                        {
                            result.Add(item.Uri.ToString());
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
    /// <summary>
    /// 获取本地Working Copy中某个文件的状态
    /// </summary>
    public static SvnStatusEventArgs GetLocalFileState(string localPath, out SvnException svnException)
    {
        Collection <SvnStatusEventArgs> status = new Collection <SvnStatusEventArgs>();
        SvnStatusArgs statusArgs = new SvnStatusArgs();

        statusArgs.RetrieveAllEntries = true;

        try
        {
            _svnClient.GetStatus(localPath, statusArgs, out status);
            if (status.Count > 0)
            {
                svnException = null;
                return(status[0]);
            }
            else
            {
                svnException = new SvnException("未知原因导致无法读取本地文件信息");
                return(null);
            }
        }
        catch (SvnException exception)
        {
            svnException = exception;
            return(null);
        }
    }
        public FileStatus GetFileStatus(string path)
        {
            Guard.NotNull(path, nameof(path));

            try
            {
                using (var client = new SvnClient())
                {
                    if (!client.GetStatus(path, out var statuses))
                    {
                        throw new Exception("Could not get status");
                    }

                    if (!statuses.Any())
                    {
                        return(FileStatus.Unchanged);
                    }

                    if (statuses.Count > 1)
                    {
                        throw new Exception("Not a file");
                    }

                    return(MapStatus(statuses.Single().LocalContentStatus));
                }
            }
            catch (SvnInvalidNodeKindException)
            {
                // expected when root does not exists.
                // do nothing specific
                if (filesystem.FileExists(path))
                {
                    return(FileStatus.Unknown);
                }

                return(FileStatus.NotExist);
            }
            catch (SvnWorkingCopyPathNotFoundException)
            {
                // path can exist on filesystem but then the file is placed in a path that is not under version control
                if (filesystem.FileExists(path))
                {
                    return(FileStatus.New);
                }

                return(FileStatus.NotExist);
            }
            catch (Exception e)
            {
                // not expected.
                // log exception (todo)
                throw e;
            }

            // if (File.Exists(path))
            //     return FileStatus.Exist;

            // return FileStatus.Unknown;
        }
        public bool IsSvnControlled(string path)
        {
            if (!Directory.Exists(path) && !File.Exists(path))
            {
                return(false);
            }

            try
            {
                Collection <SvnStatusEventArgs> statuses;
                if (_SvnClient.GetStatus(path, out statuses) && ((statuses.Count == 0) || (statuses[0].LocalContentStatus != SvnStatus.NotVersioned)))
                {
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
        // Get Source Control one file info
        public override SourceControlFileInfo.eRepositoryItemStatus GetFileStatus(string Path)
        {
            if (Path == null || Path.Length == 0)
            {
                return(SourceControlFileInfo.eRepositoryItemStatus.Unknown);
            }

            if (client == null)
            {
                Init();
            }
            System.Collections.ObjectModel.Collection <SvnStatusEventArgs> statuses;

            try
            {
                client.GetStatus(Path, out statuses);
                foreach (SvnStatusEventArgs arg in statuses)
                {
                    if (arg.LocalContentStatus == SvnStatus.Modified)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.Modified);
                    }
                    if (arg.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.New);
                    }
                    if (arg.LocalContentStatus == SvnStatus.Missing)
                    {
                        return(SourceControlFileInfo.eRepositoryItemStatus.Deleted);
                    }
                }

                return(SourceControlFileInfo.eRepositoryItemStatus.Equel);
            }
            catch (Exception)
            {
                return(SourceControlFileInfo.eRepositoryItemStatus.Unknown);
            }
        }
Example #8
0
        /*
         * This adds, modifies, and removes index entries to match the working tree.
         */
        public bool AddAll()
        {
            /*
             * var startInfo = GetStartInfo("add -A");
             *
             * // add fails if there are no files (directories don't count)
             * return ExecuteUnless(startInfo, "did not match any files");
             */
            var overallStatus = true;

            using (var client = new SvnClient())
            {
                SvnUI.Bind(client, parentWindow);

                var statusList    = (Collection <SvnStatusEventArgs>)null;
                var svnStatusArgs = new SvnStatusArgs {
                    Depth = SvnDepth.Infinity, IgnoreExternals = false, KeepDepth = false, RetrieveIgnoredEntries = false
                };

                if (client.GetStatus(useSvnStandardDirStructure ? trunkPath : workingCopyPath, svnStatusArgs, out statusList))
                {
                    overallStatus = statusList.Select(svnStatusEventArg =>
                    {
                        switch (svnStatusEventArg.LocalNodeStatus)
                        {
                        case SvnStatus.Missing:
                            logger.WriteLine("Commit: Deleting file {0} due to status = {1}", svnStatusEventArg.FullPath, svnStatusEventArg.LocalNodeStatus);
                            return(client.Delete(svnStatusEventArg.FullPath, new SvnDeleteArgs {
                                KeepLocal = false, Force = false
                            }));

                        case SvnStatus.NotVersioned:
                            logger.WriteLine("Commit: Adding file {0} due to status = {1}", svnStatusEventArg.FullPath, svnStatusEventArg.LocalNodeStatus);
                            return(client.Add(svnStatusEventArg.FullPath, new SvnAddArgs {
                                AddParents = false, Depth = SvnDepth.Infinity, Force = false
                            }));

                        default:
                            return(true);
                        }
                    })
                                    .Aggregate(true, (state, val) => state &= val);
                }
                else
                {
                    overallStatus = false;
                }
            }

            return(overallStatus);
        }
Example #9
0
 public void TestCommit()
 {
     using (SvnClient client = new SvnClient())
     {
         var localpath = "d:\\sharpsvn\\需求文档\\1.txt";
         localpath = "d:\\sharpsvn\\1.txt";
         //localpath = @"E:\project\ccms\CCMS_V7_HBYD_R";
         var username = "******";
         var pwd      = "123456";
         client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(username, pwd);
         //如果项目不存在则checkout,否则进行update
         Console.WriteLine("开始检查是否需要提交新参数表...");
         SvnCommitArgs ca = new SvnCommitArgs();
         SvnStatusArgs sa = new SvnStatusArgs();
         Collection <SvnStatusEventArgs> statuses;
         client.GetStatus(localpath, sa, out statuses);
         int i = 0;
         foreach (var item in statuses)
         {
             if (item.LocalContentStatus != item.RemoteContentStatus)
             {
                 i++;
             }
             if (!item.Versioned)
             {
                 client.Add(item.FullPath);
                 Console.WriteLine("新增加文件" + item.FullPath);
                 i++;
             }
         }
         if (i > 0)
         {
             ca.LogMessage = "测试提交文档";
             SvnCommitResult clientr;
             if (client.Commit(localpath, ca, out clientr))
             {
                 Console.WriteLine("提交完成");
             }
             else
             {
                 Console.WriteLine("提交失败");
             }
         }
         else
         {
             Console.WriteLine("无变化,无需检查");
         }
     }
 }
        private SvnStatus GetSvnStatus(SvnClient client, string path)
        {
            var sa = new SvnStatusArgs {
                Depth = SvnDepth.Empty
            };

            sa.AddExpectedError(SvnErrorCode.SVN_ERR_WC_PATH_NOT_FOUND);
            Collection <SvnStatusEventArgs> results;

            if (!client.GetStatus(path, sa, out results) ||
                results.Count != 1)
            {
                return(SvnStatus.None);
            }

            return(results[0].LocalNodeStatus);
        }
Example #11
0
        public void CheckLocalRemoteStatus()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            sbox.Create(SandBoxRepository.Default);
            string WcPath = sbox.Wc;

            string dir = WcPath;

            SvnStatusArgs sa = new SvnStatusArgs();
            sa.RetrieveRemoteStatus = true;

            Collection<SvnStatusEventArgs> r;
            using (SvnClient c = new SvnClient())
            {
                c.GetStatus(dir, sa, out r);
            }
        }
Example #12
0
        /// <summary>
        /// 工作区与版本库之间修改列表
        /// </summary>
        private void ChangeList()
        {
            using (SvnClient client = new SvnClient())
            {
                Collection <SvnStatusEventArgs> statuslist = new Collection <SvnStatusEventArgs>();

                SvnStatusArgs args = new SvnStatusArgs();
                args.Depth = SvnDepth.Infinity;

                client.GetStatus(WORKSPACE, out statuslist);

                foreach (var item in statuslist)
                {
                    Console.WriteLine(item.Path + "  " + item.LocalNodeStatus);
                }
            }
        }
        public void search(string query) {
            var queries = query.split(false, true, ' ').ToArray();
            this.root = myapp.files.Resolve("~/").ToLower();
            if(!this.root.EndsWith("/")) {
                root = root + "/";
            }
            query = query.Replace(".", "\\.").ToLower();
			var result = search(root, queries).OrderBy(x => x).ToArray();
        	PropertyBag["result"] = result;
#if SVNINTEGRATION
			IDictionary<string , SvnStatusEventArgs> svn = new Dictionary<string, SvnStatusEventArgs>();
			using (var c = new SvnClient()) {
				foreach (var r in result) {
					var ss = new Collection<SvnStatusEventArgs>();
					c.GetStatus((root+r).normalizePath(), out ss);
					svn[r] = ss[0];
				}
			}
        	PropertyBag["svn"] = svn;
#endif
        }
Example #14
0
        public CommitFile[] GetChangedFiles(string branchPath)
        {
            var changedCommitFiles = new ConcurrentQueue <CommitFile>();

            using (var svnClient = new SvnClient())
            {
                var statusArgs = new SvnStatusArgs {
                    Depth = SvnDepth.Infinity, RetrieveAllEntries = true
                };

                Collection <SvnStatusEventArgs> statuses;

                svnClient.GetStatus(branchPath, statusArgs, out statuses);

                Parallel.ForEach(statuses, (item) => {
                    if ((item.LocalContentStatus == SvnStatus.Modified ||
                         item.LocalContentStatus == SvnStatus.Added) && (item.NodeKind == SvnNodeKind.File)
                        )
                    {
                        ModifyStatus statusChange = ModifyStatus.Modified;

                        if (item.LocalContentStatus == SvnStatus.Modified)
                        {
                            statusChange = ModifyStatus.Modified;
                        }
                        else if (item.LocalContentStatus == SvnStatus.Added)
                        {
                            statusChange = ModifyStatus.Added;
                        }

                        FileInfo fi = new FileInfo(item.Path);

                        changedCommitFiles.Enqueue(new CommitFile(fi.FullName, fi.Extension,
                                                                  statusChange));
                    }
                });
            }

            return(changedCommitFiles.ToArray());
        }
Example #15
0
        public void StageAll()
        {
            using (SvnClient client = new SvnClient())
            {
                Collection <SvnStatusEventArgs> changedFiles = new Collection <SvnStatusEventArgs>();

                client.GetStatus(this.repoPath, out changedFiles);

                SvnAddArgs aa = new SvnAddArgs();
                aa.Depth    = SvnDepth.Infinity;
                aa.Force    = true;
                aa.NoIgnore = true;

                aa.Progress += this.OnProgress;
                aa.SvnError += this.OnSvnError;
                aa.Notify   += this.OnNotify;

                SvnDeleteArgs dd = new SvnDeleteArgs();
                dd.Force     = true;
                dd.Progress += this.OnProgress;
                dd.SvnError += this.OnSvnError;
                dd.Notify   += this.OnNotify;

                foreach (SvnStatusEventArgs changedFile in changedFiles)
                {
                    if (changedFile.LocalContentStatus == SvnStatus.Missing)
                    {
                        client.Delete(changedFile.Path, dd);
                    }
                    if (changedFile.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        client.Add(changedFile.Path, aa);
                    }
                }

                client.Add(this.repoPath, aa);
            }
        }
Example #16
0
        //处理有问题的文件
        public void QuestionFile(string path)
        {
            // string path = "D:\\Test";
            //SvnClient client = new SvnClient();
            SvnStatusArgs sa = new SvnStatusArgs();
            Collection <SvnStatusEventArgs> status;

            _client.GetStatus(path, sa, out status);
            foreach (var item in status)
            {
                string fPath = item.FullPath;
                if (item.LocalContentStatus != item.RemoteContentStatus)
                {
                    //被修改了的文件
                }
                if (!item.Versioned)
                {
                    //新增文件
                    _client.Add(fPath);
                }
                else if (item.Conflicted)
                {
                    //将冲突的文件用工作文件解决冲突
                    _client.Resolve(fPath, SvnAccept.Working);
                }
                else if (item.IsRemoteUpdated)
                {
                    //更新来自远程的新文件
                    _client.Update(fPath);
                }
                else if (item.LocalContentStatus == SvnStatus.Missing)
                {
                    //删除丢失的文件
                    _client.Delete(fPath);
                }
            }
        }
Example #17
0
		private void GatherSvnInformation( SvnInformation svn )
		{
			using ( var client = new SvnClient() )
			{
				var arg = new SvnStatusArgs()
				{
					Revision = new SvnRevision( SvnRevisionType.Working ),
					Depth = SvnDepth.Empty
				};
				client.Info( WorkingCopy, ( sender, e ) =>
				{
					svn.Now = DateTime.Now;
					if ( String.IsNullOrEmpty( svn.Url ) )
						svn.Url = e.Uri.AbsoluteUri;
					svn.CommitRevision = e.Revision;
				} );
				Collection<SvnStatusEventArgs> statuses;
				arg.Depth = SvnDepth.Infinity;
				arg.RetrieveAllEntries = true;
				client.GetStatus( WorkingCopy, arg, out statuses );
				foreach ( var item in statuses )
				{
					if ( string.IsNullOrEmpty( svn.RootUrl ) )
						svn.RootUrl = item.RepositoryRoot.AbsoluteUri;
					svn.MinRevision = item.Revision > 0 && ( item.Revision < svn.MinRevision || svn.MinRevision == 0 ) ? item.Revision : svn.MinRevision;
					svn.MaxRevision = item.Revision > 0 && ( item.Revision > svn.MaxRevision || svn.MaxRevision == 0 ) ? item.Revision : svn.MaxRevision;
					svn.IsSvnItem = false;
					switch ( item.LocalNodeStatus )
					{
						case SvnStatus.None:
						case SvnStatus.NotVersioned:
						case SvnStatus.Ignored:
							break;
						case SvnStatus.External:
						case SvnStatus.Incomplete:
						case SvnStatus.Normal:
							svn.IsSvnItem = true;
							break;
						default:
							svn.IsSvnItem = true;
							svn.HasModifications = true;
							break;
					}
					switch ( item.LocalPropertyStatus )
					{
						case SvnStatus.None:
						case SvnStatus.NotVersioned:
						case SvnStatus.Ignored:
							break;
						case SvnStatus.External:
						case SvnStatus.Incomplete:
						case SvnStatus.Normal:
							svn.IsSvnItem = true;
							break;
						default:
							svn.IsSvnItem = true;
							svn.HasModifications = true;
							break;
					}
				}

				svn.MixedRevisions = svn.MinRevision != svn.MaxRevision;
				svn.RevisionRange = String.Format( "{0}:{1}", svn.MinRevision, svn.MaxRevision );
			}
		}
Example #18
0
        private static void GetFileVersion(IVSSItem vssFile, IVSSVersion vssVersion, SvnClient svnClient)
        {
            numFilesHandled++;
            string dir = string.Format("{0}{1}", repoDIR, vssFile.Spec.Substring(1)).Replace("/", "\\");

            dir = Path.GetDirectoryName(dir);
            string  filePath    = Path.Combine(dir, vssFile.Name);
            VSSItem versionItem = vssVersion.VSSItem;

            try
            {
                migrateLog.DebugFormat("Fetching VSSItem: {0}, Version: {1}", versionItem.Spec, versionItem.VersionNumber);

                if (versionItem.Type != (int)VSSItemType.VSSITEM_PROJECT)
                {
                    versionItem.Get(ref filePath,
                                    (int)
                                    (VSSFlags.VSSFLAG_USERRONO | VSSFlags.VSSFLAG_CMPFAIL | VSSFlags.VSSFLAG_GETYES |
                                     VSSFlags.VSSFLAG_REPREPLACE | VSSFlags.VSSFLAG_TIMEMOD));

                    //kill them *.scc files worth for nothing
                    string[] files = Directory.GetFiles(dir, "*.scc", SearchOption.TopDirectoryOnly);
                    foreach (string file in files)
                    {
                        File.SetAttributes(file, FileAttributes.Normal);
                        File.Delete(file);
                    }
                }

                else
                {
                    Directory.CreateDirectory(filePath);
                }


                //This seems to fail rather often on binary files and directories, so dont let us use it on them

                if (versionItem.Type != (int)VSSItemType.VSSITEM_PROJECT)
                {
                    if (!versionItem.Binary)
                    {
                        migrateLog.DebugFormat("Diffing ...");
                        if (versionItem.get_IsDifferent(filePath))
                        {
                            migrateLog.WarnFormat(
                                "Files should not be different for version {0}; possible corruption in file {1}:{0}",
                                versionItem.VersionNumber, versionItem.Spec);
                        }
                    }
                }
            }
            catch (COMException e)
            {
                if (e.ErrorCode == -2147166575)
                {
                    // VSS file's checkbox "keep only latest version" is checked therefore no file could be fetched
                    // so that calling versionItem.Get(...) results in an exception
                    migrateLog.WarnFormat(
                        "Version {0} of file {1} not stored in VSS. File has option 'Keep only latest version' (see file's properties) enabled in VSS",
                        versionItem.VersionNumber, versionItem.Spec);
                }
                else
                {
                    throw;
                }
            }

            VssBindingRemover.RemoveBindings(filePath);

            Collection <SvnStatusEventArgs> svnStatus;

            svnClient.GetStatus(filePath, out svnStatus);

            if (svnStatus.Count == 1)
            {
                SvnStatus fileStatus = svnStatus[0].LocalContentStatus;
                if (fileStatus == SvnStatus.Normal)
                {
                    migrateLog.WarnFormat("No modification detected for {0}:{1}", vssVersion.VSSItem.Spec,
                                          vssVersion.VersionNumber);
                    return;
                }
                if (fileStatus == SvnStatus.NotVersioned || fileStatus == SvnStatus.Incomplete ||
                    fileStatus == SvnStatus.Missing)
                {
                    try
                    {
                        svnClient.Add(filePath);
                    }
                    catch (SvnException e)
                    {
                        if (!e.ToString().Contains("already under version"))
                        {
                            throw;
                        }
                    }
                }
            }
            else
            {
                //Should never get here because we're always looking for the results of an individual file; only display a message
                migrateLog.WarnFormat("Invalid svn status detected for {0}:{1}", vssVersion.VSSItem.Spec,
                                      vssVersion.VersionNumber);
                migrateLog.WarnFormat("Status count was: {0}", svnStatus.Count);
                return;
            }
            //simply continue as expected
        }
Example #19
0
        public static void CheckoutUpdate(Parameters parameters)
        {
            using var client = new SvnClient();
            client.Progress += new EventHandler <SvnProgressEventArgs>(Client_Progress);
            SetUpClient(parameters, client);

            var target = SvnTarget.FromString(parameters.Path);
            SvnInfoEventArgs svnInfoEventArgs;
            SvnUpdateResult  svnUpdateResult;

            var nonExistentUrl = false;
            EventHandler <SvnErrorEventArgs> ignoreNonexistent = (o, eventArgs) =>
            {
                nonExistentUrl = false;
                //if (eventArgs.Exception.SubversionErrorCode == 170000)
                if (eventArgs.Exception.Message.Contains("non-existent in revision"))
                {
                    nonExistentUrl   = true;
                    eventArgs.Cancel = true;
                }
            };

            if (client.GetWorkingCopyRoot(parameters.Path) == null)
            {
                client.SvnError += ignoreNonexistent;
                var getInfoSucceeded = client.GetInfo(SvnUriTarget.FromString(parameters.Url), out svnInfoEventArgs);
                client.SvnError -= ignoreNonexistent;

                if (!getInfoSucceeded)
                {
                    if (nonExistentUrl)
                    {
                        Console.WriteLine("SVN info reported nonexistent URL; creating remote directory.");
                        if (!client.RemoteCreateDirectory(new Uri(parameters.Url), new SvnCreateDirectoryArgs {
                            CreateParents = true, LogMessage = parameters.Message
                        }))
                        {
                            throw new Exception("Create directory failed on " + parameters.Url);
                        }
                    }
                    else
                    {
                        throw new Exception("SVN info failed");
                    }
                }

                DebugMessage(parameters, "Checking out");
                if (client.CheckOut(SvnUriTarget.FromString(parameters.Url), parameters.Path, out svnUpdateResult))
                {
                    DebugMessage(parameters, "Done");
                    Console.WriteLine("Checked out r" + svnUpdateResult.Revision);
                    return;
                }

                throw new Exception("SVN checkout failed");
            }

            if (!client.GetInfo(target, out svnInfoEventArgs))
            {
                throw new Exception("SVN info failed");
            }

            if (!UrlsMatch(svnInfoEventArgs.Uri.ToString(), parameters.Url))
            {
                throw new Exception(string.Format("A different URL is already checked out ({0} != {1})", svnInfoEventArgs.Uri, parameters.Url));
            }

            if (parameters.Cleanup)
            {
                DebugMessage(parameters, "Cleaning up");
                client.CleanUp(parameters.Path);
                DebugMessage(parameters, "Done");
            }

            if (parameters.Revert)
            {
                DebugMessage(parameters, "Reverting");
                client.Revert(parameters.Path);
                DebugMessage(parameters, "Done");
            }

            if (parameters.DeleteUnversioned)
            {
                DebugMessage(parameters, "Deleting unversioned files");
                Collection <SvnStatusEventArgs> changedFiles;
                client.GetStatus(parameters.Path, out changedFiles);
                foreach (var changedFile in changedFiles)
                {
                    if (changedFile.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        if (changedFile.NodeKind == SvnNodeKind.Directory)
                        {
                            DebugMessage(parameters, "NodeKind is directory for [" + changedFile.FullPath + "]");
                        }
                        if ((File.GetAttributes(changedFile.FullPath) & FileAttributes.Directory) == FileAttributes.Directory)
                        {
                            DebugMessage(parameters, "Deleting directory [" + changedFile.FullPath + "] recursively!");
                            Directory.Delete(changedFile.FullPath, true);
                        }
                        else
                        {
                            DebugMessage(parameters, "Deleting file [" + changedFile.FullPath + "]");
                            File.Delete(changedFile.FullPath);
                        }
                    }
                }
                DebugMessage(parameters, "Done");
            }

            DebugMessage(parameters, "Updating");
            if (client.Update(parameters.Path, out svnUpdateResult))
            {
                DebugMessage(parameters, "Done");
                Console.WriteLine("Updated to r" + svnUpdateResult.Revision);
                return;
            }

            throw new Exception("SVN update failed");
        }
Example #20
0
        public static void CompleteSync(Parameters parameters)
        {
            using (var client = new SvnClient())
            {
                client.Progress += new EventHandler <SvnProgressEventArgs>(Client_Progress);
                SetUpClient(parameters, client);

                if (parameters.UpdateBeforeCompleteSync)
                {
                    DebugMessage(parameters, "Updating");
                    client.Update(parameters.Path);
                    DebugMessage(parameters, "Done");
                }

                Collection <SvnStatusEventArgs> changedFiles;
                DebugMessage(parameters, "Getting status");
                client.GetStatus(parameters.Path, out changedFiles);
                DebugMessage(parameters, "Done");
                if (changedFiles.Count == 0)
                {
                    Console.WriteLine("No changes to commit.");
                    return;
                }

                //delete files from subversion that are not in filesystem
                //add files to subversion that are new in filesystem
                //modified files are automatically included as part of the commit

                //TODO: check remoteStatus
                DebugMessage(parameters, "Recording changes");
                foreach (var changedFile in changedFiles)
                {
                    if (changedFile.LocalContentStatus == SvnStatus.Missing)
                    {
                        // SVN thinks file is missing but it still exists hence
                        // a change in the case of the filename.
                        if (File.Exists(changedFile.Path))
                        {
                            var changedArgs = new SvnDeleteArgs {
                                KeepLocal = true
                            };
                            client.Delete(changedFile.Path, changedArgs);
                        }
                        else
                        {
                            client.Delete(changedFile.Path);
                        }
                    }
                    if (changedFile.LocalContentStatus == SvnStatus.NotVersioned)
                    {
                        client.Add(changedFile.Path);
                    }
                }
                DebugMessage(parameters, "Done");

                var ca = new SvnCommitArgs {
                    LogMessage = parameters.Message
                };
                SvnCommitResult result;
                DebugMessage(parameters, "Committing");
                if (client.Commit(parameters.Path, ca, out result))
                {
                    DebugMessage(parameters, "Done");
                    if (result == null)
                    {
                        Console.WriteLine("No result returned from commit.");
                        return;
                    }
                    if (!string.IsNullOrEmpty(result.PostCommitError))
                    {
                        Console.WriteLine("Post-commit hook error: " + result.PostCommitError);
                        return;
                    }
                    Console.WriteLine("Committed r" + result.Revision);
                }
                else
                {
                    if (result != null && !string.IsNullOrEmpty(result.PostCommitError))
                    {
                        Console.WriteLine("Post-commit hook error after failed commit: " + result.PostCommitError);
                        return;
                    }
                    Console.WriteLine("Commit failed.");
                }
            }
        }
        private static long GetRevision(String path)
        {
            if (String.IsNullOrEmpty(path))
                return 0;

            if (!IsWorkingCopy(path))
                return 0;

            long remoteRevision = 0;
            long localRevision = 0;

            try
            {
                using (SvnClient client = new SvnClient())
                {
                    SvnStatusArgs statusargs = new SvnStatusArgs();
                    statusargs.Depth = SvnDepth.Empty; // Adjust this to check direct files, or (recursive) directories etc
                    statusargs.RetrieveAllEntries = true;
                    statusargs.RetrieveRemoteStatus = true;

                    Collection<SvnStatusEventArgs> statuses;
                    client.GetStatus(path, statusargs, out statuses);

                    remoteRevision = statuses[0].Revision;
                }
            }
            catch (Exception)
            {
                Logger.Write("Error while retrieving information from remote repo", LogLevel.Warning);
            }

            using (SvnWorkingCopyClient client = new SvnWorkingCopyClient())
            {
                SvnWorkingCopyVersion version;
                if (client.GetVersion(path, out version))
                {
                    if (version.End >= 0)
                        localRevision = version.End;
                }
            }

            if (remoteRevision > localRevision)
            {
                Logger.Write("Working copy seems to be out of date", LogLevel.Warning);
            }

            return localRevision;
        }
Example #22
0
 public static bool GetStatus(String file, out System.Collections.ObjectModel.Collection <SvnStatusEventArgs> status)
 {
     return(m_Client.GetStatus(file, out status));
 }
Example #23
0
		void CheckWcStatus(SvnClient svn)
		{
			Collection<SvnStatusEventArgs> statuses;
			if (!svn.GetStatus(_wc, out statuses))
				throw new ApplicationException("SvnClient.GetStatus returns false");

			if (statuses.Count > 0)
				throw new ApplicationException("SVN working copy has files/directories in non-normal state.\nMake reverts/remove unversioned files and try again with stage import.\n" + _wc);
		}
Example #24
0
        /// <summary>
        /// Tests an update where we contact the repository
        /// </summary>
        /*[TestMethod]
        public void TestRepositoryStatus()
        {
            // modify the file in another working copy and commit
            string wc2 = this.FindDirName(Path.Combine(this.WcPath, "wc2"));
            try
            {
                Zip.ExtractZipResource(wc2, this.GetType(), WC_FILE);
                this.RenameAdminDirs(wc2);
                using (StreamWriter w = new StreamWriter(
                                   Path.Combine(wc2, "Form.cs"), true))
                    w.Write("Hell worl");
                this.RunCommand("svn", "ci -m \"\" " + wc2);

                // find the status in our own wc
                int youngest;
                string form = Path.Combine(this.WcPath, "Form.cs");
                this.Client.Status(out youngest,
                    form, Revision.Head, new StatusCallback(this.StatusFunc),
                    false, false, true, true);

                Assert.AreEqual(e.RepositoryTextStatus,
                    SvnStatus.Modified, "Wrong status");
            }
            finally
            {
                PathUtils.RecursiveDelete(wc2);
            }
        }*/
        SvnStatusEventArgs SingleStatus(SvnClient client, string path)
        {
            SvnStatusArgs sa = new SvnStatusArgs();
            sa.Depth = SvnDepth.Empty;
            sa.RetrieveAllEntries = true;

            Collection<SvnStatusEventArgs> rslt;
            client.GetStatus(path, sa, out rslt);

            if (rslt.Count != 1)
                return null;

            SvnStatusEventArgs r = rslt[0];

            if (!r.Versioned
                && !r.Conflicted
                && r.LocalNodeStatus == SvnStatus.None
                && r.LocalTextStatus == SvnStatus.None
                && r.LocalPropertyStatus == SvnStatus.None)
            {
                return null;
            }

            return r;
        }
Example #25
0
            public bool Commit()
            
    {
                    Console.WriteLine("开始检查是否需要提交新参数表...");

                    SvnCommitArgs ca = new SvnCommitArgs();
                    SvnStatusArgs sa = new SvnStatusArgs();
                    Collection <SvnStatusEventArgs> statuses;
                    SC.GetStatus(GetAppLoc(), sa, out statuses);

                    int i = 0;

                    foreach(var item in statuses)
                    
        {
                            if (item.LocalContentStatus != item.RemoteContentStatus)
            {
                                {
                                        i++;
                                      
                }
            }
                            if (!item.Versioned)
            {
                                {
                                        SC.Add(item.FullPath);

                                        Console.WriteLine("新增加文件" + item.FullPath);

                                        i++;
                                      
                }
            }
                            else if (item.Conflicted)
            {
                                {
                                        SC.Resolve(item.FullPath, SvnAccept.Working);

                                        Console.WriteLine("处理冲突文件" + item.FullPath);

                                   
                }
            }
                            else if (item.IsRemoteUpdated)
            {
                                {
                                        SC.Update(item.FullPath);

                                        Console.WriteLine("处理冲突文件" + item.FullPath);

                                   
                }
            }
                            else if (item.LocalContentStatus == SvnStatus.Missing)
            {
                                {
                                        SC.Delete(item.FullPath);

                                        Console.WriteLine("处理丢失文件" + item.FullPath);

                                        i++;
                                      
                }
            }
                        
        }

                    if(i > 0)
                    
        {
                            ca.LogMessage = "";
                            SvnCommitResult scr;
                            if (SC.Commit(GetAppLoc(), ca, out scr))
            {
                                {
                                        Console.WriteLine("提交完成");

                                   
                }
            }
                            else
            {
                                {
                                        Console.WriteLine("提交失败");

                                   
                }
            }
                        
        }

                    else
                     {
                            Console.WriteLine("无变化,无需检查");

                        
        }


                    return true;
                
    }
Example #26
0
        /*
         * This adds, modifies, and removes index entries to match the working tree.
         */
        public bool AddAll()
        {
            /*
            var startInfo = GetStartInfo("add -A");

            // add fails if there are no files (directories don't count)
            return ExecuteUnless(startInfo, "did not match any files");
            */
            var overallStatus = true;

            using (var client = new SvnClient())
            {
                SvnUI.Bind(client, parentWindow);

                var statusList = (Collection<SvnStatusEventArgs>)null;
                var svnStatusArgs = new SvnStatusArgs { Depth = SvnDepth.Infinity, IgnoreExternals = false, KeepDepth = false, RetrieveIgnoredEntries = false };

                if (client.GetStatus(useSvnStandardDirStructure ? trunkPath : workingCopyPath, svnStatusArgs, out statusList))
                {
                    overallStatus = statusList.Select(svnStatusEventArg =>
                    {
                        switch (svnStatusEventArg.LocalNodeStatus)
                        {
                            case SvnStatus.Missing:
                                logger.WriteLine("Commit: Deleting file {0} due to status = {1}", svnStatusEventArg.FullPath, svnStatusEventArg.LocalNodeStatus);
                                return client.Delete(svnStatusEventArg.FullPath, new SvnDeleteArgs { KeepLocal = false, Force = false });
                            case SvnStatus.NotVersioned:
                                logger.WriteLine("Commit: Adding file {0} due to status = {1}", svnStatusEventArg.FullPath, svnStatusEventArg.LocalNodeStatus);
                                return client.Add(svnStatusEventArg.FullPath, new SvnAddArgs { AddParents = false, Depth = SvnDepth.Infinity, Force = false });
                            default:
                                return true;
                        }
                    })
                    .Aggregate(true, (state, val) => state &= val);
                }
                else
                    overallStatus = false;
            }

            return overallStatus;
        }
Example #27
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            lbInfo.Content = "一切正常";

            String curDir = Directory.GetCurrentDirectory();
            String curExe = System.Reflection.Assembly.GetExecutingAssembly().Location;


            SvnClient = new SvnClient();

            SvnTarget svnTargetCurDir = SvnTarget.FromString(curDir);
            SvnTarget snvTargetCurExe = SvnTarget.FromString(curExe);

            // 未使用 - 获取目录下的文件状态
            Collection<SvnStatusEventArgs> svnStatusEventArgsCollection;
            SvnClient.GetStatus(Directory.GetCurrentDirectory(), out svnStatusEventArgsCollection);

            // 未使用 - 空的
            Collection<SvnPropertyListEventArgs> svnPropertyListEventArgsCollection;
            SvnClient.GetPropertyList(Directory.GetCurrentDirectory(), out svnPropertyListEventArgsCollection);

            // 未使用 - 获取一个文件的状态
            Collection<SvnFileVersionEventArgs> svnFileVersionEventArgsCollection;
            try
            {
                SvnClient.GetFileVersions(snvTargetCurExe, out svnFileVersionEventArgsCollection);
            }
            catch(SvnWorkingCopyPathNotFoundException ex)
            {
                // 如果查询的文件未加入Repo,会抛此异常
            }

            // 未使用 - 一个好像没什么用的信息列表,目录是第一个项,没有版本号
            Collection<SvnListEventArgs> svnListEventArgsCollection;
            SvnClient.GetList(svnTargetCurDir, out svnListEventArgsCollection);

            // 未使用 - 工作目录全路径
            String workingCopyRoot = SvnClient.GetWorkingCopyRoot(Directory.GetCurrentDirectory());
            
            // 未使用 - 整个仓库的最新版本
            long revision = 0;
            SvnClient.Youngest(Directory.GetCurrentDirectory(), out revision);

            // 此目录的相关变更 和 GUI中的ShowLog一样 是此目录的相关变更           
            Collection<SvnLogEventArgs> logList;
            try
            {
                SvnClient.GetLog(Directory.GetCurrentDirectory(), out logList);
            }
            catch(SvnInvalidNodeKindException ex)
            {
                lbInfo.Content = "当前目录不是SVN目录,停用更新检查功能";
                btnUpdateAndLaunch.Visibility = Visibility.Hidden;
                return;
            }

            // 获取本地目录信息,当前版本和修改版本都是本地的
            SvnInfoEventArgs svnInfoEventArgs;
            SvnClient.GetInfo(svnTargetCurDir, out svnInfoEventArgs);

            long curRevision = svnInfoEventArgs.Revision;       // 当前的SVN版本
            long changeRevision = logList[0].Revision;          // 当前目录的最新远程变更版本

            lbVersionChange.Content = changeRevision;
            lbVersionCur.Content = svnInfoEventArgs.Revision;

            if (curRevision < changeRevision)
            {
                btnUpdateAndLaunch.Visibility = Visibility.Visible;
                lbInfo.Content = "发现新版本";
            }
            else
            {
                btnUpdateAndLaunch.Visibility = Visibility.Hidden;
                lbInfo.Content = "已经是最新版";
            }

            // --------------------------------------------------------
            // SvnWorkingCopyClient
            // --------------------------------------------------------
            SvnWorkingCopyClient svnWorkingCopyClient = new SvnWorkingCopyClient();

            // 未使用 只有一个值IsText 没看出有什么用处
            SvnWorkingCopyState svnWorkingCopyState;
            svnWorkingCopyClient.GetState(Directory.GetCurrentDirectory(), out svnWorkingCopyState);

            // 未使用 返回仅本地存在的所有修改版本 
            SvnWorkingCopyVersion svnWorkingCopyVersion;
            svnWorkingCopyClient.GetVersion(curDir, out svnWorkingCopyVersion);

            // --------------------------------------------------------
            // SvnTools
            // --------------------------------------------------------
            // 未使用 传入正确的目录却返回false????
            bool isCurDirInWorkingCopy = SvnTools.IsManagedPath(curDir);

        }
Example #28
0
        private void GatherSvnInformation(SvnInformation svn)
        {
            Log.LogMessage("Gathering SVN details from " + WorkingCopy);
            using (var client = new SvnClient())
            {
                var arg = new SvnStatusArgs()
                {
                    Revision = new SvnRevision(SvnRevisionType.Working),
                    Depth    = SvnDepth.Empty
                };
                client.Info(WorkingCopy, (sender, e) =>
                {
                    svn.Now = DateTime.Now;
                    if (String.IsNullOrEmpty(svn.Url))
                    {
                        svn.Url = e.Uri.AbsoluteUri;
                    }
                    svn.CommitRevision = e.Revision;
                });
                Collection <SvnStatusEventArgs> statuses;
                arg.Depth = SvnDepth.Infinity;
                arg.RetrieveAllEntries = true;
                client.GetStatus(WorkingCopy, arg, out statuses);
                foreach (var item in statuses)
                {
                    if (string.IsNullOrEmpty(svn.RootUrl))
                    {
                        svn.RootUrl = item.RepositoryRoot.AbsoluteUri;
                    }
                    svn.MinRevision = item.Revision > 0 && (item.Revision < svn.MinRevision || svn.MinRevision == 0) ? item.Revision : svn.MinRevision;
                    svn.MaxRevision = item.Revision > 0 && (item.Revision > svn.MaxRevision || svn.MaxRevision == 0) ? item.Revision : svn.MaxRevision;
                    svn.IsSvnItem   = false;
                    switch (item.LocalNodeStatus)
                    {
                    case SvnStatus.None:
                    case SvnStatus.NotVersioned:
                    case SvnStatus.Ignored:
                        break;

                    case SvnStatus.External:
                    case SvnStatus.Incomplete:
                    case SvnStatus.Normal:
                        svn.IsSvnItem = true;
                        break;

                    default:
                        svn.IsSvnItem        = true;
                        svn.HasModifications = true;
                        break;
                    }
                    switch (item.LocalPropertyStatus)
                    {
                    case SvnStatus.None:
                    case SvnStatus.NotVersioned:
                    case SvnStatus.Ignored:
                        break;

                    case SvnStatus.External:
                    case SvnStatus.Incomplete:
                    case SvnStatus.Normal:
                        svn.IsSvnItem = true;
                        break;

                    default:
                        svn.IsSvnItem        = true;
                        svn.HasModifications = true;
                        break;
                    }
                }

                svn.MixedRevisions = svn.MinRevision != svn.MaxRevision;
                svn.RevisionRange  = String.Format("{0}:{1}", svn.MinRevision, svn.MaxRevision);
            }
        }
Example #29
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            lbInfo.Content = "一切正常";

            String curDir = Directory.GetCurrentDirectory();
            String curExe = System.Reflection.Assembly.GetExecutingAssembly().Location;


            SvnClient = new SvnClient();

            SvnTarget svnTargetCurDir = SvnTarget.FromString(curDir);
            SvnTarget snvTargetCurExe = SvnTarget.FromString(curExe);

            // 未使用 - 获取目录下的文件状态
            Collection <SvnStatusEventArgs> svnStatusEventArgsCollection;

            SvnClient.GetStatus(Directory.GetCurrentDirectory(), out svnStatusEventArgsCollection);

            // 未使用 - 空的
            Collection <SvnPropertyListEventArgs> svnPropertyListEventArgsCollection;

            SvnClient.GetPropertyList(Directory.GetCurrentDirectory(), out svnPropertyListEventArgsCollection);

            // 未使用 - 获取一个文件的状态
            Collection <SvnFileVersionEventArgs> svnFileVersionEventArgsCollection;

            try
            {
                SvnClient.GetFileVersions(snvTargetCurExe, out svnFileVersionEventArgsCollection);
            }
            catch (SvnWorkingCopyPathNotFoundException ex)
            {
                // 如果查询的文件未加入Repo,会抛此异常
            }

            // 未使用 - 一个好像没什么用的信息列表,目录是第一个项,没有版本号
            Collection <SvnListEventArgs> svnListEventArgsCollection;

            SvnClient.GetList(svnTargetCurDir, out svnListEventArgsCollection);

            // 未使用 - 工作目录全路径
            String workingCopyRoot = SvnClient.GetWorkingCopyRoot(Directory.GetCurrentDirectory());

            // 未使用 - 整个仓库的最新版本
            long revision = 0;

            SvnClient.Youngest(Directory.GetCurrentDirectory(), out revision);

            // 此目录的相关变更 和 GUI中的ShowLog一样 是此目录的相关变更
            Collection <SvnLogEventArgs> logList;

            try
            {
                SvnClient.GetLog(Directory.GetCurrentDirectory(), out logList);
            }
            catch (SvnInvalidNodeKindException ex)
            {
                lbInfo.Content = "当前目录不是SVN目录,停用更新检查功能";
                btnUpdateAndLaunch.Visibility = Visibility.Hidden;
                return;
            }

            // 获取本地目录信息,当前版本和修改版本都是本地的
            SvnInfoEventArgs svnInfoEventArgs;

            SvnClient.GetInfo(svnTargetCurDir, out svnInfoEventArgs);

            long curRevision    = svnInfoEventArgs.Revision;    // 当前的SVN版本
            long changeRevision = logList[0].Revision;          // 当前目录的最新远程变更版本

            lbVersionChange.Content = changeRevision;
            lbVersionCur.Content    = svnInfoEventArgs.Revision;

            if (curRevision < changeRevision)
            {
                btnUpdateAndLaunch.Visibility = Visibility.Visible;
                lbInfo.Content = "发现新版本";
            }
            else
            {
                btnUpdateAndLaunch.Visibility = Visibility.Hidden;
                lbInfo.Content = "已经是最新版";
            }

            // --------------------------------------------------------
            // SvnWorkingCopyClient
            // --------------------------------------------------------
            SvnWorkingCopyClient svnWorkingCopyClient = new SvnWorkingCopyClient();

            // 未使用 只有一个值IsText 没看出有什么用处
            SvnWorkingCopyState svnWorkingCopyState;

            svnWorkingCopyClient.GetState(Directory.GetCurrentDirectory(), out svnWorkingCopyState);

            // 未使用 返回仅本地存在的所有修改版本
            SvnWorkingCopyVersion svnWorkingCopyVersion;

            svnWorkingCopyClient.GetVersion(curDir, out svnWorkingCopyVersion);

            // --------------------------------------------------------
            // SvnTools
            // --------------------------------------------------------
            // 未使用 传入正确的目录却返回false????
            bool isCurDirInWorkingCopy = SvnTools.IsManagedPath(curDir);
        }
Example #30
0
        /// <summary>
        /// While the server isn't up to date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doSvnUpdate(object sender, DoWorkEventArgs e)
        {
            client = new SvnClient();
            client.Notify += onSvnNotify;
            client.Authentication.Clear();
            client.Authentication.DefaultCredentials = null;

            System.Console.Out.WriteLine(client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory()));

            Uri rep = client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory());
            Uri rel = new Uri("http://subversion.assembla.com/svn/skyrimonlineupdate/");

            if (rep == null || rep != rel)
            {
                SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory());
                exploreDirectory(rel);

                download.Maximum = iCount;
                updating = true;

                SvnCheckOutArgs args = new SvnCheckOutArgs();
                args.AllowObstructions = true;

                if (client.CheckOut(rel, System.IO.Directory.GetCurrentDirectory(), args, out mResult))
                {
                    updated = true;
                }

            }
            else
            {
                downloadprogress.Text = "Building update list, please be patient...";

                updating = true;
                SvnStatusArgs sa = new SvnStatusArgs();
                sa.RetrieveRemoteStatus = true;

                Collection<SvnStatusEventArgs> r;
                client.GetStatus(System.IO.Directory.GetCurrentDirectory(), sa, out r);

                foreach (SvnStatusEventArgs i in r)
                {
                    client.Revert(i.FullPath);

                    if (i.IsRemoteUpdated)
                        iCount++;
                }

                download.Maximum = iCount;
                SvnUpdateArgs args = new SvnUpdateArgs();
                args.AllowObstructions = true;

                if (client.Update(System.IO.Directory.GetCurrentDirectory(), args))
                {
                    updated = true;
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Example #31
0
        /// <summary>
        /// While the server isn't up to date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doSvnUpdate(object sender, DoWorkEventArgs e)
        {
            client         = new SvnClient();
            client.Notify += onSvnNotify;
            client.Authentication.Clear();
            client.Authentication.DefaultCredentials = null;

            System.Console.Out.WriteLine(client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory()));

            Uri rep = client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory());
            Uri rel = new Uri("http://subversion.assembla.com/svn/skyrimonlineupdate/");

            if (rep == null || rep != rel)
            {
                SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory());
                exploreDirectory(rel);

                download.Maximum = iCount;
                updating         = true;

                SvnCheckOutArgs args = new SvnCheckOutArgs();
                args.AllowObstructions = true;

                if (client.CheckOut(rel, System.IO.Directory.GetCurrentDirectory(), args, out mResult))
                {
                    updated = true;
                }
            }
            else
            {
                downloadprogress.Text = "Building update list, please be patient...";


                updating = true;
                SvnStatusArgs sa = new SvnStatusArgs();
                sa.RetrieveRemoteStatus = true;

                Collection <SvnStatusEventArgs> r;
                client.GetStatus(System.IO.Directory.GetCurrentDirectory(), sa, out r);

                foreach (SvnStatusEventArgs i in r)
                {
                    client.Revert(i.FullPath);

                    if (i.IsRemoteUpdated)
                    {
                        iCount++;
                    }
                }

                download.Maximum = iCount;
                SvnUpdateArgs args = new SvnUpdateArgs();
                args.AllowObstructions = true;

                if (client.Update(System.IO.Directory.GetCurrentDirectory(), args))
                {
                    updated = true;
                }
                else
                {
                    Application.Exit();
                }
            }
        }