Exemplo n.º 1
0
        private VersionInfo GetFileStatus(Repository repo, FilePath sourcefile, bool getRemoteStatus)
        {
            SubversionRepository     srepo = (SubversionRepository)repo;
            SubversionVersionControl vcs   = (SubversionVersionControl)repo.VersionControlSystem;

            // If the directory is not versioned, there is no version info
            if (!Directory.Exists(GetDirectoryDotSvn(vcs, sourcefile.ParentDirectory)))
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }
            if (!sourcefile.IsChildPathOf(srepo.RootPath))
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            List <VersionInfo> statuses = new List <VersionInfo> ();

            statuses.AddRange(Status(repo, sourcefile, SvnRevision.Head, false, false, getRemoteStatus));

            if (statuses.Count == 0)
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            if (statuses.Count != 1)
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            VersionInfo ent = (VersionInfo)statuses[0];

            if (ent.IsDirectory)
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            return(ent);
        }
Exemplo n.º 2
0
		public virtual void Setup ()
		{
			Process svnAdmin;
			ProcessStartInfo info;

			// Generate directories and a svn util.
			svnCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);

			// Create repo in "repo".
			svnAdmin = new Process ();
			info = new ProcessStartInfo ();
			info.FileName = "svnadmin";
			info.Arguments = "create " + svnRoot + Path.DirectorySeparatorChar + "repo";
			info.WindowStyle = ProcessWindowStyle.Hidden;
			svnAdmin.StartInfo = info;
			svnAdmin.Start ();
			svnAdmin.WaitForExit ();

			// Create host (Win32)
			// This needs to be done after doing the svnAdmin creation.
			// And before checkout.
			if (svnServe != null) {
				info = new ProcessStartInfo ();
				info.FileName = "svnserve";
				info.Arguments = "-dr " + svnRoot;
				info.WindowStyle = ProcessWindowStyle.Hidden;
				svnServe.StartInfo = info;
				svnServe.Start ();

				// Create user to auth.
				using (var perm = File. CreateText (svnRoot + Path.DirectorySeparatorChar + "repo" +
				                                    Path.DirectorySeparatorChar + "conf" + Path.DirectorySeparatorChar + "svnserve.conf")) {
					perm.WriteLine ("[general]");
					perm.WriteLine ("anon-access = write");
					perm.WriteLine ("[sasl]");
				}
			}

			// Check out the repository.
			Checkout (svnCheckout);
			repo = GetRepo (repoLocation, svnCheckout);
		}