Flush() публичный Метод

public Flush ( ) : void
Результат void
Пример #1
0
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
		/// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
		public virtual void SetupRepository()
		{
			// create initial commit
			git = new Git(db);
			initialCommit = git.Commit().SetMessage("initial commit").Call();
			// create nested file
			FilePath dir = new FilePath(db.WorkTree, "dir");
			FileUtils.Mkdir(dir);
			FilePath nestedFile = new FilePath(dir, "b.txt");
			FileUtils.CreateNewFile(nestedFile);
			PrintWriter nesterFileWriter = new PrintWriter(nestedFile);
			nesterFileWriter.Write("content");
			nesterFileWriter.Flush();
			// create file
			indexFile = new FilePath(db.WorkTree, "a.txt");
			FileUtils.CreateNewFile(indexFile);
			PrintWriter writer = new PrintWriter(indexFile);
			writer.Write("content");
			writer.Flush();
			// add file and commit it
			git.Add().AddFilepattern("dir").AddFilepattern("a.txt").Call();
			secondCommit = git.Commit().SetMessage("adding a.txt and dir/b.txt").Call();
			prestage = DirCache.Read(db.GetIndexFile(), db.FileSystem).GetEntry(indexFile.GetName
				());
			// modify file and add to index
			writer.Write("new content");
			writer.Close();
			nesterFileWriter.Write("new content");
			nesterFileWriter.Close();
			git.Add().AddFilepattern("a.txt").AddFilepattern("dir").Call();
			// create a file not added to the index
			untrackedFile = new FilePath(db.WorkTree, "notAddedToIndex.txt");
			FileUtils.CreateNewFile(untrackedFile);
			PrintWriter writer2 = new PrintWriter(untrackedFile);
			writer2.Write("content");
			writer2.Close();
		}
Пример #2
0
		public static void ReportWarning(string message, Exception t)
		{
			int[] linep = new int[] { 0 };
			string filename = GetSourcePositionFromStack(linep);
			TextWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			pw.WriteLine(message);
			Sharpen.Runtime.PrintStackTrace(t, pw);
			pw.Flush();
			Rhino.Context.ReportWarning(sw.ToString(), filename, linep[0], null, 0);
		}
Пример #3
0
 /// <exception cref="System.IO.IOException"></exception>
 /// <exception cref="NGit.Api.Errors.NoFilepatternException"></exception>
 /// <exception cref="NGit.Api.Errors.NoHeadException"></exception>
 /// <exception cref="NGit.Api.Errors.NoMessageException"></exception>
 /// <exception cref="NGit.Api.Errors.ConcurrentRefUpdateException"></exception>
 /// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
 /// <exception cref="NGit.Api.Errors.WrongRepositoryStateException"></exception>
 public virtual void SetupRepository()
 {
     // create initial commit
     git = new Git(db);
     initialCommit = git.Commit().SetMessage("initial commit").Call();
     // create file
     indexFile = new FilePath(db.WorkTree, "a.txt");
     FileUtils.CreateNewFile(indexFile);
     PrintWriter writer = new PrintWriter(indexFile);
     writer.Write("content");
     writer.Flush();
     // add file and commit it
     git.Add().AddFilepattern("a.txt").Call();
     git.Commit().SetMessage("adding a.txt").Call();
     // modify file and add to index
     writer.Write("new content");
     writer.Close();
     git.Add().AddFilepattern("a.txt").Call();
     // create a file not added to the index
     untrackedFile = new FilePath(db.WorkTree, "notAddedToIndex.txt");
     FileUtils.CreateNewFile(untrackedFile);
     PrintWriter writer2 = new PrintWriter(untrackedFile);
     writer2.Write("content");
     writer2.Close();
 }