# HG changeset patch # User Artem Tikhomirov # Date 1342109232 -7200 # Node ID c02b5710d9acc4b9fd9fa422c9d87b750f799255 # Parent 0e34b8f3946af974dcdd8e3312db987d1c0ad5c6 Defect: only first file in directory got flags initialized diff -r 0e34b8f3946a -r c02b5710d9ac src/org/tmatesoft/hg/util/RegularFileInfo.java --- 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 diff -r 0e34b8f3946a -r c02b5710d9ac src/org/tmatesoft/hg/util/RegularFileStats.java --- 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 links = dir2links.get(dirName); - Set execs = dir2execs.get(dirName); - if (links == null || execs == null) { - try { + try { + Map links = dir2links.get(dirName); + Set execs = dir2execs.get(dirName); + if (links == null || execs == null) { ArrayList cmd = new ArrayList(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;