Mercurial > jhg
changeset 476:c02b5710d9ac
Defect: only first file in directory got flags initialized
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 12 Jul 2012 18:07:12 +0200 (2012-07-12) |
parents | 0e34b8f3946a |
children | 9c9d09111aee |
files | src/org/tmatesoft/hg/util/RegularFileInfo.java src/org/tmatesoft/hg/util/RegularFileStats.java |
diffstat | 2 files changed, 25 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/util/RegularFileInfo.java Thu Jul 12 16:57:40 2012 +0200 +++ b/src/org/tmatesoft/hg/util/RegularFileInfo.java Thu Jul 12 18:07:12 2012 +0200 @@ -101,6 +101,12 @@ return supportsLink && fileFlagsHelper.isSymlink(); } + @Override + public String toString() { + char t = exists() ? (isExecutable() ? '*' : (isSymlink() ? '@' : '-')) : '!'; + return String.format("RegularFileInfo[%s %c]", file.getPath(), t); + } + private byte[] getLinkTargetBytes() { assert isSymlink(); // no idea what encoding Mercurial uses for link targets, assume platform native is ok
--- a/src/org/tmatesoft/hg/util/RegularFileStats.java Thu Jul 12 16:57:40 2012 +0200 +++ b/src/org/tmatesoft/hg/util/RegularFileStats.java Thu Jul 12 18:07:12 2012 +0200 @@ -108,10 +108,10 @@ } final String dirName = f.getParentFile().getAbsolutePath(); final String fileName = f.getName(); - Map<String, String> links = dir2links.get(dirName); - Set<String> execs = dir2execs.get(dirName); - if (links == null || execs == null) { - try { + try { + Map<String, String> links = dir2links.get(dirName); + Set<String> execs = dir2execs.get(dirName); + if (links == null || execs == null) { ArrayList<String> cmd = new ArrayList<String>(command); cmd.add(dirName); CharSequence result = execHelper.exec(cmd); @@ -134,23 +134,23 @@ } dir2links.put(dirName, links); dir2execs.put(dirName, execs); - isExec = execs.contains(fileName); - isSymlink = links.containsKey(fileName); - if (isSymlink) { - symlinkValue = links.get(fileName); - } else { - symlinkValue = null; - } - } catch (InterruptedException ex) { - sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f)); - // try again? ensure not too long? stop right away? - // IGNORE, keep isExec and isSymlink false - } catch (IOException ex) { - sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f)); - // IGNORE, keep isExec and isSymlink false } + isExec = execs.contains(fileName); + isSymlink = links.containsKey(fileName); + if (isSymlink) { + symlinkValue = links.get(fileName); + } else { + symlinkValue = null; + } + } catch (InterruptedException ex) { + sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f)); + // try again? ensure not too long? stop right away? + // IGNORE, keep isExec and isSymlink false + } catch (IOException ex) { + sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f)); + // IGNORE, keep isExec and isSymlink false } - } +} public boolean isExecutable() { return isExec;