annotate src/org/tmatesoft/hg/internal/WorkingDirFileWriter.java @ 657:6334b0267103

ParentChildMap can supply RevisionMap. Refactor ArrayHelper to keep most of sorted/reverse index magic inside
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 04 Jul 2013 20:27:45 +0200
parents 6526d8adbc0f
children b4242b7e7dfe
rev   line source
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012-2013 TMate Software Ltd
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.internal;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
19 import static org.tmatesoft.hg.util.LogFacility.Severity.Warn;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
20
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 import java.io.File;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 import java.io.FileOutputStream;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 import java.io.IOException;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import java.nio.ByteBuffer;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25 import java.nio.channels.FileChannel;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 import org.tmatesoft.hg.repo.HgDataFile;
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
28 import org.tmatesoft.hg.repo.HgManifest;
628
6526d8adbc0f Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 580
diff changeset
29 import org.tmatesoft.hg.repo.HgRuntimeException;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 import org.tmatesoft.hg.util.ByteChannel;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 import org.tmatesoft.hg.util.CancelledException;
526
2f9ed6bcefa2 Initial support for Revert command with accompanying minor refactoring
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 525
diff changeset
32 import org.tmatesoft.hg.util.LogFacility.Severity;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 import org.tmatesoft.hg.util.Path;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 /**
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 *
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 * @author Artem Tikhomirov
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 * @author TMate Software Ltd.
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 */
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 public class WorkingDirFileWriter implements ByteChannel {
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42
526
2f9ed6bcefa2 Initial support for Revert command with accompanying minor refactoring
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 525
diff changeset
43 private final Internals hgRepo;
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
44 private final boolean execCap, symlinkCap;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
45 private final FileSystemHelper fileFlagsHelper;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 private File dest;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 private FileChannel destChannel;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 private int totalBytesWritten;
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
49 private ByteArrayChannel linkChannel;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
50 private int fmode;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51
526
2f9ed6bcefa2 Initial support for Revert command with accompanying minor refactoring
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 525
diff changeset
52 public WorkingDirFileWriter(Internals internalRepo) {
2f9ed6bcefa2 Initial support for Revert command with accompanying minor refactoring
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 525
diff changeset
53 hgRepo = internalRepo;
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
54 execCap = Internals.checkSupportsExecutables(internalRepo.getRepo().getWorkingDir());
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
55 symlinkCap = Internals.checkSupportsSymlinks(internalRepo.getRepo().getWorkingDir());
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
56 if (symlinkCap || execCap) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
57 fileFlagsHelper = new FileSystemHelper(internalRepo.getSessionContext());
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
58 } else {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
59 fileFlagsHelper = null;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
60 }
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 }
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
62
572
becd2a1310a2 Report file object in case of error to be helpful as much as possible
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 526
diff changeset
63 /**
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
64 * Writes content of specified file revision into local filesystem, or create a symlink according to flags.
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
65 * Executable bit is set if specified and filesystem supports it.
628
6526d8adbc0f Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 580
diff changeset
66 * @throws HgRuntimeException
572
becd2a1310a2 Report file object in case of error to be helpful as much as possible
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 526
diff changeset
67 */
628
6526d8adbc0f Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 580
diff changeset
68 public void processFile(HgDataFile df, int fileRevIndex, HgManifest.Flags flags) throws IOException, HgRuntimeException {
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
69 try {
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70 prepare(df.getPath());
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
71 if (flags != HgManifest.Flags.Link) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
72 destChannel = new FileOutputStream(dest).getChannel();
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
73 } else {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
74 linkChannel = new ByteArrayChannel();
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
75 }
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
76 df.contentWithFilters(fileRevIndex, this);
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77 } catch (CancelledException ex) {
526
2f9ed6bcefa2 Initial support for Revert command with accompanying minor refactoring
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 525
diff changeset
78 hgRepo.getSessionContext().getLog().dump(getClass(), Severity.Error, ex, "Our impl doesn't throw cancellation");
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
79 } finally {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
80 if (flags != HgManifest.Flags.Link) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
81 destChannel.close();
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
82 destChannel = null;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
83 // leave dest in case anyone enquires with #getDestinationFile
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
84 }
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85 }
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
86 if (linkChannel != null && symlinkCap) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
87 assert flags == HgManifest.Flags.Link;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
88 fileFlagsHelper.createSymlink(dest.getParentFile(), dest.getName(), linkChannel.toArray());
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
89 } else if (flags == HgManifest.Flags.Exec && execCap) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
90 fileFlagsHelper.setExecutableBit(dest.getParentFile(), dest.getName());
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
91 }
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
92 // Although HgWCStatusCollector treats 644 (`hg manifest -v`) and 664 (my fs) the same, it's better
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
93 // to detect actual flags here
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
94 fmode = flags.fsMode(); // default to one from manifest
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
95 if (fileFlagsHelper != null) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
96 // if neither execBit nor link is supported by fs, it's unlikely file mode is supported, too.
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
97 try {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
98 fmode = fileFlagsHelper.getFileMode(dest, fmode);
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
99 } catch (IOException ex) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
100 // Warn, we've got default value and can live with it
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
101 hgRepo.getSessionContext().getLog().dump(getClass(), Warn, ex, "Failed get file access rights");
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
102 }
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
103 }
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
104 }
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
105
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
106 public void prepare(Path fname) throws IOException {
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
107 String fpath = fname.toString();
526
2f9ed6bcefa2 Initial support for Revert command with accompanying minor refactoring
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 525
diff changeset
108 dest = new File(hgRepo.getRepo().getWorkingDir(), fpath);
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
109 if (fpath.indexOf('/') != -1) {
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
110 dest.getParentFile().mkdirs();
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
111 }
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
112 destChannel = null;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
113 linkChannel = null;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
114 totalBytesWritten = 0;
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
115 fmode = 0;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
116 }
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
117
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
118 public int write(ByteBuffer buffer) throws IOException, CancelledException {
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
119 final int written;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
120 if (linkChannel != null) {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
121 written = linkChannel.write(buffer);
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
122 } else {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
123 written = destChannel.write(buffer);
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
124 }
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
125 totalBytesWritten += written;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
126 return written;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
127 }
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
128
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
129 /**
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
130 * Information purposes only, to find out trouble location if {@link #processFile(HgDataFile, int)} fails
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
131 */
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
132 public File getDestinationFile() {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
133 return dest;
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
134 }
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
135
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
136 public int bytesWritten() {
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
137 return totalBytesWritten;
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
138 }
580
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
139
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
140 public int fmode() {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
141 return fmode;
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
142 }
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
143
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
144 public int mtime() {
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
145 return (int) (dest.lastModified() / 1000);
bd5926e24aa3 Respect unix flags for checkout/revert
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 572
diff changeset
146 }
525
0be5be8d57e9 Repository checkout support, first iteration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
147 }