Mercurial > jhg
annotate src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 609:e4a71afd3c71
Test TODOs: test for ConfigFile (covering %include and %unset directives)
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Wed, 08 May 2013 17:11:45 +0200 | 
| parents | e1b29756f901 | 
| children | f41dd9a3b8af | 
| rev | line source | 
|---|---|
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 1 /* | 
| 537 
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
506diff
changeset | 2 * Copyright (c) 2011-2013 TMate Software Ltd | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 3 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 4 * This program is free software; you can redistribute it and/or modify | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 5 * it under the terms of the GNU General Public License as published by | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 6 * the Free Software Foundation; version 2 of the License. | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 7 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 8 * This program is distributed in the hope that it will be useful, | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 11 * GNU General Public License for more details. | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 12 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 13 * For information on how to redistribute this software under | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 14 * the terms of a license other than GNU General Public License | 
| 102 
a3a2e5deb320
Updated contact address to support@hg4j.com
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
94diff
changeset | 15 * contact TMate Software at support@hg4j.com | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 16 */ | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 17 package org.tmatesoft.hg.repo; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 18 | 
| 120 
b19f0ac5ee62
Check against working copy shall expect non-persistent modifications done by filters and not report such files as modified
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
117diff
changeset | 19 import static java.lang.Math.max; | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 20 import static java.lang.Math.min; | 
| 218 
047b1dec7a04
Issue 7: Correctly handle manifest and changelog with different number of (or non-matching) revisions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
195diff
changeset | 21 import static org.tmatesoft.hg.repo.HgRepository.*; | 
| 456 
909306e412e2
Refactor LogFacility and SessionContext, better API for both
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
431diff
changeset | 22 import static org.tmatesoft.hg.util.LogFacility.Severity.*; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 23 | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 24 import java.io.File; | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 25 import java.io.IOException; | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 26 import java.nio.ByteBuffer; | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 27 import java.nio.channels.ReadableByteChannel; | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 28 import java.util.ArrayList; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 29 import java.util.Collections; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 30 import java.util.NoSuchElementException; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 31 import java.util.Set; | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 32 import java.util.TreeSet; | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 33 | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 34 import org.tmatesoft.hg.core.Nodeid; | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 35 import org.tmatesoft.hg.core.SessionContext; | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 36 import org.tmatesoft.hg.internal.ByteArrayChannel; | 
| 506 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 37 import org.tmatesoft.hg.internal.Experimental; | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 38 import org.tmatesoft.hg.internal.FilterByteChannel; | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 39 import org.tmatesoft.hg.internal.Internals; | 
| 248 
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
246diff
changeset | 40 import org.tmatesoft.hg.internal.ManifestRevision; | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 41 import org.tmatesoft.hg.internal.PathPool; | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 42 import org.tmatesoft.hg.internal.PathScope; | 
| 355 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 43 import org.tmatesoft.hg.internal.Preview; | 
| 356 
91d75e1bac9f
Consistent approach to deal with adaptable objects. Give adaptable precedence over instanceof to allow conditional response when classes do implement desired interface
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
355diff
changeset | 44 import org.tmatesoft.hg.util.Adaptable; | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 45 import org.tmatesoft.hg.util.ByteChannel; | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 46 import org.tmatesoft.hg.util.CancelSupport; | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 47 import org.tmatesoft.hg.util.CancelledException; | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 48 import org.tmatesoft.hg.util.Convertor; | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 49 import org.tmatesoft.hg.util.FileInfo; | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 50 import org.tmatesoft.hg.util.FileIterator; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 51 import org.tmatesoft.hg.util.FileWalker; | 
| 133 
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
120diff
changeset | 52 import org.tmatesoft.hg.util.Path; | 
| 93 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 53 import org.tmatesoft.hg.util.PathRewrite; | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 54 import org.tmatesoft.hg.util.RegularFileInfo; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 55 | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 56 /** | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 57 * | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 58 * @author Artem Tikhomirov | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 59 * @author TMate Software Ltd. | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 60 */ | 
| 94 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 61 public class HgWorkingCopyStatusCollector { | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 62 | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 63 private final HgRepository repo; | 
| 141 
8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
133diff
changeset | 64 private final FileIterator repoWalker; | 
| 59 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 65 private HgDirstate dirstate; | 
| 94 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 66 private HgStatusCollector baseRevisionCollector; | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 67 private Convertor<Path> pathPool; | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 68 private ManifestRevision dirstateParentManifest; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 69 | 
| 362 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 70 /** | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 71 * Collector that iterates over complete working copy | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 72 */ | 
| 94 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 73 public HgWorkingCopyStatusCollector(HgRepository hgRepo) { | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 74 this(hgRepo, new HgInternals(hgRepo).createWorkingDirWalker(null)); | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 75 } | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 76 | 
| 362 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 77 /** | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 78 * Collector may analyze and report status for any arbitrary sub-tree of the working copy. | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 79 * File iterator shall return names of the files relative to the repository root. | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 80 * | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 81 * @param hgRepo status target repository | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 82 * @param workingCopyWalker iterator over files in the working copy | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 83 */ | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 84 public HgWorkingCopyStatusCollector(HgRepository hgRepo, FileIterator workingCopyWalker) { | 
| 218 
047b1dec7a04
Issue 7: Correctly handle manifest and changelog with different number of (or non-matching) revisions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
195diff
changeset | 85 repo = hgRepo; | 
| 362 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 86 repoWalker = workingCopyWalker; | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 87 } | 
| 59 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 88 | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 89 /** | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 90 * Optionally, supply a collector instance that may cache (or have already cached) base revision | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 91 * @param sc may be null | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 92 */ | 
| 94 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 93 public void setBaseRevisionCollector(HgStatusCollector sc) { | 
| 59 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 94 baseRevisionCollector = sc; | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 95 } | 
| 93 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 96 | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 97 /*package-local*/ Convertor<Path> getPathPool() { | 
| 93 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 98 if (pathPool == null) { | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 99 if (baseRevisionCollector == null) { | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 100 pathPool = new PathPool(new PathRewrite.Empty()); | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 101 } else { | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 102 return baseRevisionCollector.getPathPool(); | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 103 } | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 104 } | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 105 return pathPool; | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 106 } | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 107 | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 108 public void setPathPool(Convertor<Path> pathConvertor) { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 109 pathPool = pathConvertor; | 
| 93 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 110 } | 
| 
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
91diff
changeset | 111 | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 112 /** | 
| 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 113 * Access to directory state information this collector uses. | 
| 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 114 * @return directory state holder, never <code>null</code> | 
| 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 115 */ | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 116 public HgDirstate getDirstate() throws HgInvalidControlFileException { | 
| 59 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 117 if (dirstate == null) { | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 118 Convertor<Path> pp = getPathPool(); | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 119 Path.Source ps; | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 120 if (pp instanceof Path.Source) { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 121 ps = (Path.Source) pp; | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 122 } else { | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 123 ps = new Path.SimpleSource(new PathRewrite.Empty(), pp); | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 124 } | 
| 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 125 dirstate = repo.loadDirstate(ps); | 
| 59 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 126 } | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 127 return dirstate; | 
| 
b771e94a4f7c
Introduce Internals to keep LocalHgRepo casts and alike in a single place. WCSC optionally to reuse SC data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
58diff
changeset | 128 } | 
| 275 
6d1804fe0ed7
Issue 10: Report file content length with respect of metadata. Respect dirstate parents for WC's status. Exceptions to keep useful attributes of the location
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
248diff
changeset | 129 | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 130 private HgDirstate getDirstateImpl() { | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 131 return dirstate; | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 132 } | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 133 | 
| 366 
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
362diff
changeset | 134 private ManifestRevision getManifest(int changelogLocalRev) throws HgInvalidControlFileException { | 
| 284 
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
282diff
changeset | 135 assert changelogLocalRev >= 0; | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 136 ManifestRevision mr; | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 137 if (baseRevisionCollector != null) { | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 138 mr = baseRevisionCollector.raw(changelogLocalRev); | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 139 } else { | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 140 mr = new ManifestRevision(null, null); | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 141 repo.getManifest().walk(changelogLocalRev, changelogLocalRev, mr); | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 142 } | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 143 return mr; | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 144 } | 
| 354 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 145 | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 146 private void initDirstateParentManifest() throws HgInvalidControlFileException { | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 147 Nodeid dirstateParent = getDirstateImpl().parents().first(); | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 148 if (dirstateParent.isNull()) { | 
| 405 
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
397diff
changeset | 149 dirstateParentManifest = baseRevisionCollector != null ? baseRevisionCollector.raw(NO_REVISION) : HgStatusCollector.createEmptyManifestRevision(); | 
| 354 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 150 } else { | 
| 367 
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
366diff
changeset | 151 int changeloRevIndex = repo.getChangelog().getRevisionIndex(dirstateParent); | 
| 
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
366diff
changeset | 152 dirstateParentManifest = getManifest(changeloRevIndex); | 
| 354 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 153 } | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 154 } | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 155 | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 156 // WC not necessarily points to TIP, but may be result of update to any previous revision. | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
350diff
changeset | 157 // In such case, we need to compare local files not to their TIP content, but to specific version at the time of selected revision | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 158 private ManifestRevision getDirstateParentManifest() { | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 159 return dirstateParentManifest; | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 160 } | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 161 | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 162 /** | 
| 429 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 163 * Walk working copy, analyze status for each file found and missing. | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 164 * May be invoked few times. | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 165 * | 
| 506 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 166 * <p>There's no dedicated constant for working copy parent, at least now. | 
| 429 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 167 * Use {@link HgRepository#WORKING_COPY} to indicate comparison | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 168 * shall be run against working copy parent. Although a bit confusing, single case doesn't | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 169 * justify a dedicated constant. | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 170 * | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 171 * @param baseRevision revision index to check against, or {@link HgRepository#WORKING_COPY}. Note, {@link HgRepository#TIP} is not supported. | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 172 * @param inspector callback to receive status information | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 173 * @throws IOException to propagate IO errors from {@link FileIterator} | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 174 * @throws CancelledException if operation execution was cancelled | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 175 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 176 */ | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 177 public void walk(int baseRevision, HgStatusInspector inspector) throws IOException, CancelledException, HgRuntimeException { | 
| 367 
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
366diff
changeset | 178 if (HgInternals.wrongRevisionIndex(baseRevision) || baseRevision == BAD_REVISION) { | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 179 throw new HgInvalidRevisionException(baseRevision); | 
| 218 
047b1dec7a04
Issue 7: Correctly handle manifest and changelog with different number of (or non-matching) revisions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
195diff
changeset | 180 } | 
| 362 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 181 if (getDirstateImpl() == null) { | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 182 getDirstate(); | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 183 } | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 184 if (getDirstateParentManifest() == null) { | 
| 
4937e35b805b
Report dirstate access error with Exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
360diff
changeset | 185 initDirstateParentManifest(); | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 186 } | 
| 429 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 187 // XXX NOTE, use of TIP for working copy parent is questionable, at least. Instead, TIP shall mean latest cset or not allowed at all | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 188 ManifestRevision collect = null; // non null indicates we compare against base revision | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 189 Set<Path> baseRevFiles = Collections.emptySet(); // files from base revision not affected by status calculation | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 190 if (baseRevision != TIP && baseRevision != WORKING_COPY) { | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 191 collect = getManifest(baseRevision); | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 192 baseRevFiles = new TreeSet<Path>(collect.files()); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 193 } | 
| 94 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 194 if (inspector instanceof HgStatusCollector.Record) { | 
| 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 195 HgStatusCollector sc = baseRevisionCollector == null ? new HgStatusCollector(repo) : baseRevisionCollector; | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 196 // nodeidAfterChange(dirstate's parent) doesn't make too much sense, | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 197 // because the change might be actually in working copy. Nevertheless, | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 198 // as long as no nodeids can be provided for WC, seems reasonable to report | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 199 // latest known nodeid change (although at the moment this is not used and | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 200 // is done mostly not to leave stale initialization in the Record) | 
| 537 
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
506diff
changeset | 201 int rev1,rev2 = getDirstateParentManifest().changesetRevisionIndex(); | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 202 if (baseRevision == TIP || baseRevision == WORKING_COPY) { | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 203 rev1 = rev2 - 1; // just use revision prior to dirstate's parent | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 204 } else { | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 205 rev1 = baseRevision; | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 206 } | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 207 ((HgStatusCollector.Record) inspector).init(rev1, rev2, sc); | 
| 68 
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
63diff
changeset | 208 } | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 209 final CancelSupport cs = CancelSupport.Factory.get(inspector); | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 210 final HgIgnore hgIgnore = repo.getIgnore(); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 211 repoWalker.reset(); | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 212 TreeSet<Path> processed = new TreeSet<Path>(); // names of files we handled as they known to Dirstate (not FileIterator) | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 213 final HgDirstate ds = getDirstateImpl(); | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 214 TreeSet<Path> knownEntries = ds.all(); // here just to get dirstate initialized | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 215 while (repoWalker.hasNext()) { | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 216 cs.checkCancelled(); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 217 repoWalker.next(); | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 218 final Path fname = getPathPool().mangle(repoWalker.name()); | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 219 FileInfo f = repoWalker.file(); | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 220 Path knownInDirstate; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 221 if (!f.exists()) { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 222 // file coming from iterator doesn't exist. | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 223 if ((knownInDirstate = ds.known(fname)) != null) { | 
| 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 224 // found in dirstate | 
| 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 225 processed.add(knownInDirstate); | 
| 294 
32890bab7209
Issue 13: Report filenames as they are known in repository rather than from file system
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
293diff
changeset | 226 if (ds.checkRemoved(knownInDirstate) == null) { | 
| 
32890bab7209
Issue 13: Report filenames as they are known in repository rather than from file system
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
293diff
changeset | 227 inspector.missing(knownInDirstate); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 228 } else { | 
| 294 
32890bab7209
Issue 13: Report filenames as they are known in repository rather than from file system
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
293diff
changeset | 229 inspector.removed(knownInDirstate); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 230 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 231 // do not report it as removed later | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 232 if (collect != null) { | 
| 294 
32890bab7209
Issue 13: Report filenames as they are known in repository rather than from file system
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
293diff
changeset | 233 baseRevFiles.remove(knownInDirstate); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 234 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 235 } else { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 236 // chances are it was known in baseRevision. We may rely | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 237 // that later iteration over baseRevFiles leftovers would yield correct Removed, | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 238 // but it doesn't hurt to be explicit (provided we know fname *is* inScope of the FileIterator | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 239 if (collect != null && baseRevFiles.remove(fname)) { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 240 inspector.removed(fname); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 241 } else { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 242 // not sure I shall report such files (i.e. arbitrary name coming from FileIterator) | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 243 // as unknown. Command-line HG aborts "system can't find the file specified" | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 244 // in similar case (against wc), or just gives nothing if --change <rev> is specified. | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 245 // however, as it's unlikely to get unexisting files from FileIterator, and | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 246 // its better to see erroneous file status rather than not to see any (which is too easy | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 247 // to overlook), I think unknown() is reasonable approach here | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 248 inspector.unknown(fname); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 249 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 250 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 251 continue; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 252 } | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 253 if ((knownInDirstate = ds.known(fname)) != null) { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 254 // tracked file. | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 255 // modified, added, removed, clean | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 256 processed.add(knownInDirstate); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 257 if (collect != null) { // need to check against base revision, not FS file | 
| 294 
32890bab7209
Issue 13: Report filenames as they are known in repository rather than from file system
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
293diff
changeset | 258 checkLocalStatusAgainstBaseRevision(baseRevFiles, collect, baseRevision, knownInDirstate, f, inspector); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 259 } else { | 
| 294 
32890bab7209
Issue 13: Report filenames as they are known in repository rather than from file system
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
293diff
changeset | 260 checkLocalStatusAgainstFile(knownInDirstate, f, inspector); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 261 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 262 } else { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 263 if (hgIgnore.isIgnored(fname)) { // hgignore shall be consulted only for non-tracked files | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 264 inspector.ignored(fname); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 265 } else { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 266 inspector.unknown(fname); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 267 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 268 // the file is not tracked. Even if it's known at baseRevision, we don't need to remove it | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 269 // from baseRevFiles, it might need to be reported as removed as well (cmdline client does | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 270 // yield two statuses for the same file) | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 271 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 272 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 273 if (collect != null) { | 
| 473 
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
471diff
changeset | 274 // perhaps, this code shall go after processing leftovers of knownEntries, below | 
| 
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
471diff
changeset | 275 // as it's sort of last resort - what to do with otherwise unprocessed base revision files | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 276 for (Path fromBase : baseRevFiles) { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 277 if (repoWalker.inScope(fromBase)) { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 278 inspector.removed(fromBase); | 
| 473 
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
471diff
changeset | 279 processed.add(fromBase); | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 280 cs.checkCancelled(); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 281 } | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 282 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 283 } | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 284 knownEntries.removeAll(processed); | 
| 284 
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
282diff
changeset | 285 for (Path m : knownEntries) { | 
| 
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
282diff
changeset | 286 if (!repoWalker.inScope(m)) { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 287 // do not report as missing/removed those FileIterator doesn't care about. | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 288 continue; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 289 } | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 290 cs.checkCancelled(); | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 291 // missing known file from a working dir | 
| 293 
9774f47d904d
Issue 13: Status reports filenames with case other than in dirstate incorrectly
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
290diff
changeset | 292 if (ds.checkRemoved(m) == null) { | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 293 // not removed from the repository = 'deleted' | 
| 284 
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
282diff
changeset | 294 inspector.missing(m); | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 295 } else { | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
68diff
changeset | 296 // removed from the repo | 
| 76 
658fa6b3a371
Fixed a defect when a file added and removed past some revision was reported as R for status against that rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
74diff
changeset | 297 // if we check against non-tip revision, do not report files that were added past that revision and now removed. | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 298 if (collect == null || baseRevFiles.contains(m)) { | 
| 284 
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
282diff
changeset | 299 inspector.removed(m); | 
| 76 
658fa6b3a371
Fixed a defect when a file added and removed past some revision was reported as R for status against that rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
74diff
changeset | 300 } | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 301 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 302 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 303 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 304 | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 305 /** | 
| 429 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 306 * A {@link #walk(int, HgStatusInspector)} that records all the status information in the {@link HgStatusCollector.Record} object. | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 307 * | 
| 429 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 308 * @see #walk(int, HgStatusInspector) | 
| 
cd658b24a620
FIXMEs: javadoc, proper use of constants
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
425diff
changeset | 309 * @param baseRevision revision index to check against, or {@link HgRepository#WORKING_COPY}. Note, {@link HgRepository#TIP} is not supported. | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 310 * @return information object that describes change between the revisions | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 311 * @throws IOException to propagate IO errors from {@link FileIterator} | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 312 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 313 */ | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 314 public HgStatusCollector.Record status(int baseRevision) throws IOException, HgRuntimeException { | 
| 94 
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
93diff
changeset | 315 HgStatusCollector.Record rv = new HgStatusCollector.Record(); | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 316 try { | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 317 walk(baseRevision, rv); | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 318 } catch (CancelledException ex) { | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 319 // can't happen as long our Record class doesn't implement CancelSupport | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 320 HgInvalidStateException t = new HgInvalidStateException("Internal error"); | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 321 t.initCause(ex); | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 322 throw t; | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 323 } | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 324 return rv; | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 325 } | 
| 506 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 326 | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 327 /** | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 328 * Compares file state from working directory against parent recorded in dirstate. | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 329 * Might be handy for merged files, always reported as 'modified' or files deemed modified | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 330 * based on their flags change. | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 331 * | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 332 * @param fname repository-relative path to the file in question | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 333 * @param fileInfo file content mediator | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 334 * @return <code>true</code> when content in working dir differs from that of manifest-recorded revision | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 335 */ | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 336 @Experimental(reason="Perhaps, HgDataFile#isWorkingCopyChanged() would be better - no need to pass any arguments?") | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 337 public boolean hasTangibleChanges(Path fname, FileInfo fileInfo) throws HgRuntimeException { | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 338 // see #checkLocalStatusAgainstFile() below for the origin of changed file check | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 339 HgDataFile df = repo.getFileNode(fname); | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 340 if (!df.exists()) { | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 341 throw new HgInvalidFileException("File not found", null).setFileName(fname); | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 342 } | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 343 Nodeid rev = getDirstateParentManifest().nodeid(fname); | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 344 return rev == null || !areTheSame(fileInfo, df, rev); | 
| 
27398bbfd543
Experiment to add a facility to check working files for actual changes
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
496diff
changeset | 345 } | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 346 | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 347 //******************************************** | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 348 | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 349 | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 350 private void checkLocalStatusAgainstFile(Path fname, FileInfo f, HgStatusInspector inspector) { | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 351 HgDirstate.Record r; | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 352 if ((r = getDirstateImpl().checkNormal(fname)) != null) { | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 353 // either clean or modified | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 354 final boolean timestampEqual = f.lastModified() == r.modificationTime(), sizeEqual = r.size() == f.length(); | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 355 if (timestampEqual && sizeEqual) { | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 356 // if flags change (chmod -x), timestamp does not change | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 357 if (checkFlagsEqual(f, r.mode())) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 358 inspector.clean(fname); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 359 } else { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 360 inspector.modified(fname); // flags are not the same | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 361 } | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 362 } else if (!sizeEqual && r.size() >= 0) { | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 363 inspector.modified(fname); | 
| 496 
c1c8f6859d3f
Recognize 'merged from parent' metastate in dirstate
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
493diff
changeset | 364 } else if (r.size() == -2) { | 
| 
c1c8f6859d3f
Recognize 'merged from parent' metastate in dirstate
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
493diff
changeset | 365 // DirState wiki calls this np2 metastate: | 
| 
c1c8f6859d3f
Recognize 'merged from parent' metastate in dirstate
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
493diff
changeset | 366 // 'np2': merged from other parent (status == 'n', size == -2) | 
| 
c1c8f6859d3f
Recognize 'merged from parent' metastate in dirstate
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
493diff
changeset | 367 inspector.modified(fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 368 } else { | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 369 // size is the same or unknown, and, perhaps, different timestamp | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 370 // check actual content to avoid false modified files | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 371 try { | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 372 if (!checkFlagsEqual(f, r.mode())) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 373 // flags modified, no need to do expensive content check | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 374 inspector.modified(fname); | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 375 } else { | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 376 HgDataFile df = repo.getFileNode(fname); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 377 if (!df.exists()) { | 
| 608 
e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
537diff
changeset | 378 Internals implRepo = repo.getImplHelper(); | 
| 493 
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
490diff
changeset | 379 String msg = String.format("File %s known as normal in dirstate (%d, %d), doesn't exist at %s", fname, r.modificationTime(), r.size(), implRepo.getStoragePath(df)); | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 380 throw new HgInvalidFileException(msg, null).setFileName(fname); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 381 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 382 Nodeid rev = getDirstateParentManifest().nodeid(fname); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 383 // rev might be null here if fname comes to dirstate as a result of a merge operation | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 384 // where one of the parents (first parent) had no fname file, but second parent had. | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 385 // E.g. fork revision 3, revision 4 gets .hgtags, few modifications and merge(3,12) | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 386 // see Issue 14 for details | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 387 if (rev == null || !areTheSame(f, df, rev)) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 388 inspector.modified(df.getPath()); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 389 } else { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 390 inspector.clean(df.getPath()); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 391 } | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 392 } | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 393 } catch (HgRuntimeException ex) { | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 394 repo.getSessionContext().getLog().dump(getClass(), Warn, ex, null); | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 395 inspector.invalid(fname, ex); | 
| 120 
b19f0ac5ee62
Check against working copy shall expect non-persistent modifications done by filters and not report such files as modified
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
117diff
changeset | 396 } | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 397 } | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 398 } else if ((r = getDirstateImpl().checkAdded(fname)) != null) { | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 399 if (r.copySource() == null) { | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 400 inspector.added(fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 401 } else { | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 402 inspector.copied(r.copySource(), fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 403 } | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 404 } else if ((r = getDirstateImpl().checkRemoved(fname)) != null) { | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 405 inspector.removed(fname); | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 406 } else if ((r = getDirstateImpl().checkMerged(fname)) != null) { | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 407 inspector.modified(fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 408 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 409 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 410 | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 411 // XXX refactor checkLocalStatus methods in more OO way | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 412 private void checkLocalStatusAgainstBaseRevision(Set<Path> baseRevNames, ManifestRevision collect, int baseRevision, Path fname, FileInfo f, HgStatusInspector inspector) { | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 413 // fname is in the dirstate, either Normal, Added, Removed or Merged | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 414 Nodeid nid1 = collect.nodeid(fname); | 
| 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 415 HgManifest.Flags flags = collect.flags(fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 416 HgDirstate.Record r; | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 417 final HgDirstate ds = getDirstateImpl(); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 418 if (nid1 == null) { | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 419 // not known at the time of baseRevision: | 
| 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 420 // normal, added, merged: either added or copied since base revision. | 
| 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 421 // removed: nothing to report, | 
| 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 422 if (ds.checkNormal(fname) != null || ds.checkMerged(fname) != null) { | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 423 try { | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 424 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, baseRevNames, baseRevision); | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 425 if (origin != null) { | 
| 431 
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
429diff
changeset | 426 inspector.copied(getPathPool().mangle(origin), fname); | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 427 return; | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 428 } | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 429 // fall-through, report as added | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 430 } catch (HgInvalidFileException ex) { | 
| 360 
150500515714
Report non-critical errors during status operation to handler/inspector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
356diff
changeset | 431 // report failure and continue status collection | 
| 
150500515714
Report non-critical errors during status operation to handler/inspector
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
356diff
changeset | 432 inspector.invalid(fname, ex); | 
| 90 
a95c700408a9
Correctly report copy/rename events for rev..working copy case
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
89diff
changeset | 433 } | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 434 } else if ((r = ds.checkAdded(fname)) != null) { | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 435 if (r.copySource() != null && baseRevNames.contains(r.copySource())) { | 
| 473 
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
471diff
changeset | 436 // shall not remove rename source from baseRevNames, as the source | 
| 
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
471diff
changeset | 437 // likely needs to be reported as Removed as well | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 438 inspector.copied(r.copySource(), fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 439 return; | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 440 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 441 // fall-through, report as added | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 442 } else if (ds.checkRemoved(fname) != null) { | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 443 // removed: removed file was not known at the time of baseRevision, and we should not report it as removed | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 444 return; | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 445 } | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 446 inspector.added(fname); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 447 } else { | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 448 // was known; check whether clean or modified | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 449 Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname); | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 450 if ((r = ds.checkNormal(fname)) != null && nid1.equals(nidFromDirstate)) { | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 451 // regular file, was the same up to WC initialization. Check if was modified since, and, if not, report right away | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 452 // same code as in #checkLocalStatusAgainstFile | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 453 final boolean timestampEqual = f.lastModified() == r.modificationTime(), sizeEqual = r.size() == f.length(); | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 454 boolean handled = false; | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 455 if (timestampEqual && sizeEqual) { | 
| 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 456 inspector.clean(fname); | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 457 handled = true; | 
| 290 
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
287diff
changeset | 458 } else if (!sizeEqual && r.size() >= 0) { | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 459 inspector.modified(fname); | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 460 handled = true; | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 461 } else if (!checkFlagsEqual(f, flags)) { | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 462 // seems like flags have changed, no reason to check content further | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 463 inspector.modified(fname); | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 464 handled = true; | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 465 } | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 466 if (handled) { | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 467 baseRevNames.remove(fname); // consumed, processed, handled. | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 468 return; | 
| 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 469 } | 
| 282 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 470 // otherwise, shall check actual content (size not the same, or unknown (-1 or -2), or timestamp is different, | 
| 
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
280diff
changeset | 471 // or nodeid in dirstate is different, but local change might have brought it back to baseRevision state) | 
| 280 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 472 // FALL THROUGH | 
| 
35125450c804
Erroneous and slow status for working copies based on non-tip revision
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
275diff
changeset | 473 } | 
| 471 
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
456diff
changeset | 474 if (r != null || (r = ds.checkMerged(fname)) != null || (r = ds.checkAdded(fname)) != null) { | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 475 try { | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 476 // check actual content to see actual changes | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 477 // when added - seems to be the case of a file added once again, hence need to check if content is different | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 478 // either clean or modified | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 479 HgDataFile fileNode = repo.getFileNode(fname); | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 480 if (areTheSame(f, fileNode, nid1)) { | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 481 inspector.clean(fname); | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 482 } else { | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 483 inspector.modified(fname); | 
| 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 484 } | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 485 } catch (HgRuntimeException ex) { | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 486 repo.getSessionContext().getLog().dump(getClass(), Warn, ex, null); | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 487 inspector.invalid(fname, ex); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 488 } | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 489 baseRevNames.remove(fname); // consumed, processed, handled. | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
337diff
changeset | 490 } else if (getDirstateImpl().checkRemoved(fname) != null) { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 491 // was known, and now marked as removed, report it right away, do not rely on baseRevNames processing later | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 492 inspector.removed(fname); | 
| 285 
6dbbc53fc46d
Use Path instead of plain String for manifest file names
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
284diff
changeset | 493 baseRevNames.remove(fname); // consumed, processed, handled. | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 494 } | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 495 // only those left in baseRevNames after processing are reported as removed | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 496 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 497 | 
| 608 
e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
537diff
changeset | 498 // TODO [post-1.1] think over if content comparison may be done more effectively by e.g. calculating nodeid for a local file and comparing it with nodeid from manifest | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 499 // we don't need to tell exact difference, hash should be enough to detect difference, and it doesn't involve reading historical file content, and it's relatively | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 500 // cheap to calc hash on a file (no need to keep it completely in memory). OTOH, if I'm right that the next approach is used for nodeids: | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 501 // changeset nodeid + hash(actual content) => entry (Nodeid) in the next Manifest | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 502 // then it's sufficient to check parents from dirstate, and if they do not match parents from file's baseRevision (non matching parents means different nodeids). | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 503 // The question is whether original Hg treats this case (same content, different parents and hence nodeids) as 'modified' or 'clean' | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 504 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 505 | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 506 private boolean areTheSame(FileInfo f, HgDataFile dataFile, Nodeid revision) throws HgInvalidFileException { | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 507 // XXX consider adding HgDataDile.compare(File/byte[]/whatever) operation to optimize comparison | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 508 ByteArrayChannel bac = new ByteArrayChannel(); | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 509 try { | 
| 367 
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
366diff
changeset | 510 int fileRevisionIndex = dataFile.getRevisionIndex(revision); | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 511 // need content with metadata striped off - although theoretically chances are metadata may be different, | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 512 // WC doesn't have it anyway | 
| 367 
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
366diff
changeset | 513 dataFile.content(fileRevisionIndex, bac); | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 514 } catch (CancelledException ex) { | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 515 // silently ignore - can't happen, ByteArrayChannel is not cancellable | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 516 } | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 517 return areTheSame(f, bac.toArray(), dataFile.getPath()); | 
| 157 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 518 } | 
| 
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
148diff
changeset | 519 | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 520 private boolean areTheSame(FileInfo f, final byte[] data, Path p) throws HgInvalidFileException { | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 521 ReadableByteChannel is = null; | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 522 class Check implements ByteChannel { | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 523 final boolean debug = repo.getSessionContext().getLog().isDebug(); | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 524 boolean sameSoFar = true; | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 525 int x = 0; | 
| 219 
d63583b47bfa
ArrayIndexOutOfBoundsException when file appended. Erroneous 'areTheSame' when trailing were deleted.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
218diff
changeset | 526 | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 527 public int write(ByteBuffer buffer) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 528 for (int i = buffer.remaining(); i > 0; i--, x++) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 529 if (x >= data.length /*file has been appended*/ || data[x] != buffer.get()) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 530 if (debug) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 531 byte[] xx = new byte[15]; | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 532 if (buffer.position() > 5) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 533 buffer.position(buffer.position() - 5); | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 534 } | 
| 334 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 535 buffer.get(xx, 0, min(xx.length, i-1 /*-1 for the one potentially read at buffer.get in if() */)); | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 536 String exp; | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 537 if (x < data.length) { | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 538 exp = new String(data, max(0, x - 4), min(data.length - x, 20)); | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 539 } else { | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 540 int offset = max(0, x - 4); | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 541 exp = new String(data, offset, min(data.length - offset, 20)); | 
| 
15e1961719f2
Investigate sporadic BufferUnderflowException
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
323diff
changeset | 542 } | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 543 repo.getSessionContext().getLog().dump(getClass(), Debug, "expected >>%s<< but got >>%s<<", exp, new String(xx)); | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 544 } | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 545 sameSoFar = false; | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 546 break; | 
| 219 
d63583b47bfa
ArrayIndexOutOfBoundsException when file appended. Erroneous 'areTheSame' when trailing were deleted.
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
218diff
changeset | 547 } | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 548 } | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 549 buffer.position(buffer.limit()); // mark as read | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 550 return buffer.limit(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 551 } | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 552 | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 553 public boolean sameSoFar() { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 554 return sameSoFar; | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 555 } | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 556 public boolean ultimatelyTheSame() { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 557 return sameSoFar && x == data.length; | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 558 } | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 559 }; | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 560 Check check = new Check(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 561 try { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 562 is = f.newInputChannel(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 563 ByteBuffer fb = ByteBuffer.allocate(min(1 + data.length * 2 /*to fit couple of lines appended; never zero*/, 8192)); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 564 FilterByteChannel filters = new FilterByteChannel(check, repo.getFiltersFromWorkingDirToRepo(p)); | 
| 356 
91d75e1bac9f
Consistent approach to deal with adaptable objects. Give adaptable precedence over instanceof to allow conditional response when classes do implement desired interface
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
355diff
changeset | 565 Preview preview = Adaptable.Factory.getAdapter(filters, Preview.class, null); | 
| 355 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 566 if (preview != null) { | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 567 while (is.read(fb) != -1) { | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 568 fb.flip(); | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 569 preview.preview(fb); | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 570 fb.clear(); | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 571 } | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 572 // reset channel to read once again | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 573 try { | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 574 is.close(); | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 575 } catch (IOException ex) { | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 576 repo.getSessionContext().getLog().dump(getClass(), Info, ex, null); | 
| 355 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 577 } | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 578 is = f.newInputChannel(); | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 579 fb.clear(); | 
| 
f2c11fe7f3e9
Newline filter shall respect whole stream when deciding whether to process line terminators, hence added stream preview functionality
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 580 } | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 581 while (is.read(fb) != -1 && check.sameSoFar()) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 582 fb.flip(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 583 filters.write(fb); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 584 fb.compact(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 585 } | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 586 return check.ultimatelyTheSame(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 587 } catch (CancelledException ex) { | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 588 repo.getSessionContext().getLog().dump(getClass(), Warn, ex, "Unexpected cancellation"); | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 589 return check.ultimatelyTheSame(); | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 590 } catch (IOException ex) { | 
| 397 
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
367diff
changeset | 591 throw new HgInvalidFileException("File comparison failed", ex).setFileName(p); | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 592 } finally { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 593 if (is != null) { | 
| 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 594 try { | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 595 is.close(); | 
| 295 
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
294diff
changeset | 596 } catch (IOException ex) { | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 597 repo.getSessionContext().getLog().dump(getClass(), Info, ex, null); | 
| 117 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 598 } | 
| 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 599 } | 
| 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 600 } | 
| 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 601 } | 
| 
6c0be854d149
Enable filters for status operation (ToRepo case)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 602 | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 603 /** | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 604 * @return <code>true</code> if flags are the same | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 605 */ | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 606 private boolean checkFlagsEqual(FileInfo f, HgManifest.Flags originalManifestFlags) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 607 boolean same = true; | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 608 if (repoWalker.supportsLinkFlag()) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 609 if (originalManifestFlags == HgManifest.Flags.Link) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 610 return f.isSymlink(); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 611 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 612 // original flag is not link, hence flags are the same if file is not link, too. | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 613 same = !f.isSymlink(); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 614 } // otherwise treat flags the same | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 615 if (repoWalker.supportsExecFlag()) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 616 if (originalManifestFlags == HgManifest.Flags.Exec) { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 617 return f.isExecutable(); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 618 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 619 // original flag has no executable attribute, hence file shall not be executable, too | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 620 same = same || !f.isExecutable(); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 621 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 622 return same; | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 623 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 624 | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 625 private boolean checkFlagsEqual(FileInfo f, int dirstateFileMode) { | 
| 608 
e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
537diff
changeset | 626 return checkFlagsEqual(f, HgManifest.Flags.parse(dirstateFileMode)); | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 627 } | 
| 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 628 | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 629 /** | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 630 * Configure status collector to consider only subset of a working copy tree. Tries to be as effective as possible, and to | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 631 * traverse only relevant part of working copy on the filesystem. | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 632 * | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 633 * @param hgRepo repository | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 634 * @param paths repository-relative files and/or directories. Directories are processed recursively. | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 635 * | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 636 * @return new instance of {@link HgWorkingCopyStatusCollector}, ready to {@link #walk(int, HgStatusInspector) walk} associated working copy | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 637 */ | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 638 public static HgWorkingCopyStatusCollector create(HgRepository hgRepo, Path... paths) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 639 ArrayList<Path> f = new ArrayList<Path>(5); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 640 ArrayList<Path> d = new ArrayList<Path>(5); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 641 for (Path p : paths) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 642 if (p.isDirectory()) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 643 d.add(p); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 644 } else { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 645 f.add(p); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 646 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 647 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 648 // final Path[] dirs = f.toArray(new Path[d.size()]); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 649 if (d.isEmpty()) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 650 final Path[] files = f.toArray(new Path[f.size()]); | 
| 490 
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
473diff
changeset | 651 FileIterator fi = new FileListIterator(hgRepo.getSessionContext(), hgRepo.getWorkingDir(), files); | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 652 return new HgWorkingCopyStatusCollector(hgRepo, fi); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 653 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 654 // | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 655 | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 656 //FileIterator fi = file.isDirectory() ? new DirFileIterator(hgRepo, file) : new FileListIterator(, file); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 657 FileIterator fi = new HgInternals(hgRepo).createWorkingDirWalker(new PathScope(true, paths)); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 658 return new HgWorkingCopyStatusCollector(hgRepo, fi); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 659 } | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 660 | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 661 /** | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 662 * Configure collector object to calculate status for matching files only. | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 663 * This method may be less effective than explicit list of files as it iterates over whole repository | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 664 * (thus supplied matcher doesn't need to care if directories to files in question are also in scope, | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 665 * see {@link FileWalker#FileWalker(File, Path.Source, Path.Matcher)}) | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 666 * | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 667 * @return new instance of {@link HgWorkingCopyStatusCollector}, ready to {@link #walk(int, HgStatusInspector) walk} associated working copy | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 668 */ | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 669 public static HgWorkingCopyStatusCollector create(HgRepository hgRepo, Path.Matcher scope) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 670 FileIterator w = new HgInternals(hgRepo).createWorkingDirWalker(null); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 671 FileIterator wf = (scope == null || scope instanceof Path.Matcher.Any) ? w : new FileIteratorFilter(w, scope); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 672 // the reason I need to iterate over full repo and apply filter is that I have no idea whatsoever about | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 673 // patterns in the scope. I.e. if scope lists a file (PathGlobMatcher("a/b/c.txt")), FileWalker won't get deep | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 674 // to the file unless matcher would also explicitly include "a/", "a/b/" in scope. Since I can't rely | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 675 // users would write robust matchers, and I don't see a decent way to enforce that (i.e. factory to produce | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 676 // correct matcher from Path is much like what PathScope does, and can be accessed directly with #create(repo, Path...) | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 677 // method above/ | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 678 return new HgWorkingCopyStatusCollector(hgRepo, wf); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 679 } | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 680 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 681 private static class FileListIterator implements FileIterator { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 682 private final File dir; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 683 private final Path[] paths; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 684 private int index; | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 685 private RegularFileInfo nextFile; | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 686 private final boolean execCap, linkCap; | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 687 private final SessionContext sessionContext; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 688 | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 689 public FileListIterator(SessionContext ctx, File startDir, Path... files) { | 
| 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 690 sessionContext = ctx; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 691 dir = startDir; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 692 paths = files; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 693 reset(); | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 694 execCap = Internals.checkSupportsExecutables(startDir); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 695 linkCap = Internals.checkSupportsSymlinks(startDir); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 696 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 697 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 698 public void reset() { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 699 index = -1; | 
| 425 
48f993aa2f41
FIXMEs: exceptions, javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 700 nextFile = new RegularFileInfo(sessionContext, execCap, linkCap); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 701 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 702 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 703 public boolean hasNext() { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 704 return paths.length > 0 && index < paths.length-1; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 705 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 706 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 707 public void next() { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 708 index++; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 709 if (index == paths.length) { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 710 throw new NoSuchElementException(); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 711 } | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 712 nextFile.init(new File(dir, paths[index].toString())); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 713 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 714 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 715 public Path name() { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 716 return paths[index]; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 717 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 718 | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 719 public FileInfo file() { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 720 return nextFile; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 721 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 722 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 723 public boolean inScope(Path file) { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 724 for (int i = 0; i < paths.length; i++) { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 725 if (paths[i].equals(file)) { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 726 return true; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 727 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 728 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 729 return false; | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 730 } | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 731 | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 732 public boolean supportsExecFlag() { | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 733 return execCap; | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 734 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 735 | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 736 public boolean supportsLinkFlag() { | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
415diff
changeset | 737 return linkCap; | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 738 } | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 739 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 740 | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 741 private static class FileIteratorFilter implements FileIterator { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 742 private final Path.Matcher filter; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 743 private final FileIterator walker; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 744 private boolean didNext = false; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 745 | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 746 public FileIteratorFilter(FileIterator fileWalker, Path.Matcher filterMatcher) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 747 assert fileWalker != null; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 748 assert filterMatcher != null; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 749 filter = filterMatcher; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 750 walker = fileWalker; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 751 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 752 | 
| 350 
33eaed1ad130
Allow FileIterator report any errors from the underlaying file system up to the client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 753 public void reset() throws IOException { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 754 walker.reset(); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 755 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 756 | 
| 350 
33eaed1ad130
Allow FileIterator report any errors from the underlaying file system up to the client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 757 public boolean hasNext() throws IOException { | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 758 while (walker.hasNext()) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 759 walker.next(); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 760 if (filter.accept(walker.name())) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 761 didNext = true; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 762 return true; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 763 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 764 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 765 return false; | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 766 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 767 | 
| 350 
33eaed1ad130
Allow FileIterator report any errors from the underlaying file system up to the client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 768 public void next() throws IOException { | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 769 if (didNext) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 770 didNext = false; | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 771 } else { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 772 if (!hasNext()) { | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 773 throw new NoSuchElementException(); | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 774 } | 
| 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 775 } | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 776 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 777 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 778 public Path name() { | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 779 return walker.name(); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 780 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 781 | 
| 287 
ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
285diff
changeset | 782 public FileInfo file() { | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 783 return walker.file(); | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 784 } | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 785 | 
| 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 786 public boolean inScope(Path file) { | 
| 229 
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
226diff
changeset | 787 return filter.accept(file); | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 788 } | 
| 413 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 789 | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 790 public boolean supportsExecFlag() { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 791 return walker.supportsExecFlag(); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 792 } | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 793 | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 794 public boolean supportsLinkFlag() { | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 795 return walker.supportsLinkFlag(); | 
| 
7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
405diff
changeset | 796 } | 
| 226 
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
219diff
changeset | 797 } | 
| 58 
4cfc47bc14cc
Status against local working dir extracted into distinct class. Iterating over local files extracted for ease of os-dependant patching
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 798 } | 
