Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 356:91d75e1bac9f
Consistent approach to deal with adaptable objects. Give adaptable precedence over instanceof to allow conditional response when classes do implement desired interface
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 06 Dec 2011 14:25:52 +0100 |
parents | f2c11fe7f3e9 |
children | 150500515714 |
comparison
equal
deleted
inserted
replaced
355:f2c11fe7f3e9 | 356:91d75e1bac9f |
---|---|
38 import org.tmatesoft.hg.internal.Experimental; | 38 import org.tmatesoft.hg.internal.Experimental; |
39 import org.tmatesoft.hg.internal.FilterByteChannel; | 39 import org.tmatesoft.hg.internal.FilterByteChannel; |
40 import org.tmatesoft.hg.internal.ManifestRevision; | 40 import org.tmatesoft.hg.internal.ManifestRevision; |
41 import org.tmatesoft.hg.internal.PathScope; | 41 import org.tmatesoft.hg.internal.PathScope; |
42 import org.tmatesoft.hg.internal.Preview; | 42 import org.tmatesoft.hg.internal.Preview; |
43 import org.tmatesoft.hg.util.Adaptable; | |
43 import org.tmatesoft.hg.util.ByteChannel; | 44 import org.tmatesoft.hg.util.ByteChannel; |
44 import org.tmatesoft.hg.util.CancelledException; | 45 import org.tmatesoft.hg.util.CancelledException; |
45 import org.tmatesoft.hg.util.FileInfo; | 46 import org.tmatesoft.hg.util.FileInfo; |
46 import org.tmatesoft.hg.util.FileIterator; | 47 import org.tmatesoft.hg.util.FileIterator; |
47 import org.tmatesoft.hg.util.FileWalker; | 48 import org.tmatesoft.hg.util.FileWalker; |
468 Check check = new Check(); | 469 Check check = new Check(); |
469 try { | 470 try { |
470 is = f.newInputChannel(); | 471 is = f.newInputChannel(); |
471 ByteBuffer fb = ByteBuffer.allocate(min(1 + data.length * 2 /*to fit couple of lines appended; never zero*/, 8192)); | 472 ByteBuffer fb = ByteBuffer.allocate(min(1 + data.length * 2 /*to fit couple of lines appended; never zero*/, 8192)); |
472 FilterByteChannel filters = new FilterByteChannel(check, repo.getFiltersFromWorkingDirToRepo(p)); | 473 FilterByteChannel filters = new FilterByteChannel(check, repo.getFiltersFromWorkingDirToRepo(p)); |
473 Preview preview = filters.getAdapter(Preview.class); | 474 Preview preview = Adaptable.Factory.getAdapter(filters, Preview.class, null); |
474 if (preview != null) { | 475 if (preview != null) { |
475 while (is.read(fb) != -1) { | 476 while (is.read(fb) != -1) { |
476 fb.flip(); | 477 fb.flip(); |
477 preview.preview(fb); | 478 preview.preview(fb); |
478 fb.clear(); | 479 fb.clear(); |