SetLastModified() public method

public SetLastModified ( long milis ) : bool
milis long
return bool
Esempio n. 1
0
		private void WaitNextSec(FilePath f)
		{
			long initialLastModified = f.LastModified();
			do
			{
				f.SetLastModified(Runtime.CurrentTimeMillis());
			}
			while (f.LastModified() == initialLastModified);
		}
Esempio n. 2
0
 /// <summary>Kick the timestamp of a local file.</summary>
 /// <remarks>
 /// Kick the timestamp of a local file.
 /// <p>
 /// We shouldn't have to make these method calls. The cache is using file
 /// system timestamps, and on many systems unit tests run faster than the
 /// modification clock. Dumping the cache after we make an edit behind
 /// RefDirectory's back allows the tests to pass.
 /// </remarks>
 /// <param name="name">the file in the repository to force a time change on.</param>
 private void BUG_WorkAroundRacyGitIssues(string name)
 {
     FilePath path = new FilePath(db.Directory, name);
     long old = path.LastModified();
     long set = 1250379778668L;
     // Sat Aug 15 20:12:58 GMT-03:30 2009
     path.SetLastModified(set);
     NUnit.Framework.Assert.IsTrue(old != path.LastModified(), "time changed");
 }
Esempio n. 3
0
		private static void Touch(long begin, FilePath dir)
		{
			while (begin >= dir.LastModified())
			{
				try
				{
					Sharpen.Thread.Sleep(25);
				}
				catch (Exception)
				{
				}
				//
				dir.SetLastModified(Runtime.CurrentTimeMillis());
			}
		}
Esempio n. 4
0
 /// <exception cref="System.IO.IOException"></exception>
 private void WritePackedRefs(string content)
 {
     FilePath pr = new FilePath(diskRepo.Directory, "packed-refs");
     Write(pr, content);
     long now = Runtime.CurrentTimeMillis();
     int oneHourAgo = 3600 * 1000;
     pr.SetLastModified(now - oneHourAgo);
 }
Esempio n. 5
0
		public virtual void TestUpdateSmudgedEntries()
		{
			git.BranchCreate().SetName("test2").Call();
			RefUpdate rup = db.UpdateRef(Constants.HEAD);
			rup.Link("refs/heads/test2");
			FilePath file = new FilePath(db.WorkTree, "Test.txt");
			long size = file.Length();
			long mTime = file.LastModified() - 5000L;
			NUnit.Framework.Assert.IsTrue(file.SetLastModified(mTime));
			DirCache cache = DirCache.Lock(db.GetIndexFile(), db.FileSystem);
			DirCacheEntry entry = cache.GetEntry("Test.txt");
			NUnit.Framework.Assert.IsNotNull(entry);
			entry.SetLength(0);
			entry.LastModified = 0;
			cache.Write();
			NUnit.Framework.Assert.IsTrue(cache.Commit());
			cache = DirCache.Read(db.GetIndexFile(), db.FileSystem);
			entry = cache.GetEntry("Test.txt");
			NUnit.Framework.Assert.IsNotNull(entry);
			NUnit.Framework.Assert.AreEqual(0, entry.Length);
			NUnit.Framework.Assert.AreEqual(0, entry.LastModified);
			db.GetIndexFile().SetLastModified(db.GetIndexFile().LastModified() - 5000);
			NUnit.Framework.Assert.IsNotNull(git.Checkout().SetName("test").Call());
			cache = DirCache.Read(db.GetIndexFile(), db.FileSystem);
			entry = cache.GetEntry("Test.txt");
			NUnit.Framework.Assert.IsNotNull(entry);
			NUnit.Framework.Assert.AreEqual(size, entry.Length);
			NUnit.Framework.Assert.AreEqual(mTime, entry.LastModified);
		}