Commits

Esben Skovenborg committed 2921e56

Check whether the file exists, in the target revision, before calling hg log again, when a file date in map is posterior to update rev.
In practice, this can be a considerable speed-up because a proportion of the files are typically removed when going back to an earlier revision.

  • Participants
  • Parent commits 8f5155e

Comments (0)

Files changed (1)

File src/hg_timestamp.java

 				Date date = entry.getValue();
 				String filename = URLDecoder.decode(entry.getKey(), charset.name());
 				
-				if (updaterev_date.compareTo(date) < 0) {
+				if ((updaterev_date.compareTo(date) < 0) && fileExists(filename)) {
 					// file date in map is posterior to update rev: get the real last modified date for this file
 					String hg_commandf[] = {"hg", "log", "--rev=" + updaterev + ":null", "--limit=1",
 						"--template={date|isodatesec}", filename};
 
 	}  // main
 
+	static boolean fileExists(String filename) {
+		File f = new File(filename);
+		return (f.exists() && f.isFile());
+	}
+
 	static boolean touchDontCreate(String filename, Date dateTime) {
 		File f = new File(filename);
 		if (!(f.exists() && f.isFile())) {