Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgStatus.java @ 427:31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 29 Mar 2012 17:14:35 +0200 |
parents | 9c9c442b5f2e |
children | 6526d8adbc0f |
comparison
equal
deleted
inserted
replaced
426:063b0663495a | 427:31a89587eb04 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 TMate Software Ltd | 2 * Copyright (c) 2011-2012 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
18 | 18 |
19 import java.io.File; | 19 import java.io.File; |
20 import java.util.Date; | 20 import java.util.Date; |
21 | 21 |
22 import org.tmatesoft.hg.internal.ChangelogHelper; | 22 import org.tmatesoft.hg.internal.ChangelogHelper; |
23 import org.tmatesoft.hg.repo.HgInvalidControlFileException; | |
24 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 23 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
25 import org.tmatesoft.hg.util.Path; | 24 import org.tmatesoft.hg.util.Path; |
26 | 25 |
27 /** | 26 /** |
28 * Repository file status and extra handy information. | 27 * Repository file status and extra handy information. |
70 } | 69 } |
71 | 70 |
72 /** | 71 /** |
73 * @return <code>null</code> if author for the change can't be deduced (e.g. for clean files it's senseless) | 72 * @return <code>null</code> if author for the change can't be deduced (e.g. for clean files it's senseless) |
74 */ | 73 */ |
75 public String getModificationAuthor() throws HgInvalidControlFileException { | 74 public String getModificationAuthor() { |
76 RawChangeset cset = logHelper.findLatestChangeWith(path); | 75 RawChangeset cset = logHelper.findLatestChangeWith(path); |
77 if (cset == null) { | 76 if (cset == null) { |
78 if (kind == Kind.Modified || kind == Kind.Added || kind == Kind.Removed /*&& RightBoundary is TIP*/) { | 77 if (kind == Kind.Modified || kind == Kind.Added || kind == Kind.Removed /*&& RightBoundary is TIP*/) { |
79 // perhaps, also for Kind.Missing? | 78 // perhaps, also for Kind.Missing? |
80 return logHelper.getNextCommitUsername(); | 79 return logHelper.getNextCommitUsername(); |
83 return cset.user(); | 82 return cset.user(); |
84 } | 83 } |
85 return null; | 84 return null; |
86 } | 85 } |
87 | 86 |
88 public Date getModificationDate() throws HgInvalidControlFileException { | 87 public Date getModificationDate() { |
89 RawChangeset cset = logHelper.findLatestChangeWith(path); | 88 RawChangeset cset = logHelper.findLatestChangeWith(path); |
90 if (cset == null) { | 89 if (cset == null) { |
91 File localFile = new File(logHelper.getRepo().getWorkingDir(), path.toString()); | 90 File localFile = new File(logHelper.getRepo().getWorkingDir(), path.toString()); |
92 if (localFile.canRead()) { | 91 if (localFile.canRead()) { |
93 return new Date(localFile.lastModified()); | 92 return new Date(localFile.lastModified()); |