Lines 61-66
Link Here
|
61 |
import org.netbeans.libs.git.GitException; |
61 |
import org.netbeans.libs.git.GitException; |
62 |
import org.netbeans.libs.git.GitRemoteConfig; |
62 |
import org.netbeans.libs.git.GitRemoteConfig; |
63 |
import org.netbeans.modules.git.FileInformation.Status; |
63 |
import org.netbeans.modules.git.FileInformation.Status; |
|
|
64 |
import org.netbeans.modules.git.client.GitClient; |
64 |
import org.netbeans.modules.git.ui.history.SearchHistoryAction; |
65 |
import org.netbeans.modules.git.ui.history.SearchHistoryAction; |
65 |
import org.netbeans.modules.git.ui.repository.RepositoryInfo; |
66 |
import org.netbeans.modules.git.ui.repository.RepositoryInfo; |
66 |
import org.netbeans.modules.git.utils.GitUtils; |
67 |
import org.netbeans.modules.git.utils.GitUtils; |
Lines 122-131
Link Here
|
122 |
Git git = Git.getInstance(); |
123 |
Git git = Git.getInstance(); |
123 |
final File root = git.getRepositoryRoot(file); |
124 |
final File root = git.getRepositoryRoot(file); |
124 |
if (root == null) return false; |
125 |
if (root == null) return false; |
|
|
126 |
GitClient client = null; |
125 |
try { |
127 |
try { |
126 |
git.getClient(root).reset(new File[] { file }, "HEAD", true, GitUtils.NULL_PROGRESS_MONITOR); |
128 |
client = git.getClient(root); |
|
|
129 |
client.reset(new File[] { file }, "HEAD", true, GitUtils.NULL_PROGRESS_MONITOR); |
127 |
} catch (GitException ex) { |
130 |
} catch (GitException ex) { |
128 |
LOG.log(Level.INFO, "beforeCreate(): File: {0} {1}", new Object[] { file.getAbsolutePath(), ex.toString()}); //NOI18N |
131 |
LOG.log(Level.INFO, "beforeCreate(): File: {0} {1}", new Object[] { file.getAbsolutePath(), ex.toString()}); //NOI18N |
|
|
132 |
} finally { |
133 |
if (client != null) { |
134 |
client.release(); |
135 |
} |
129 |
} |
136 |
} |
130 |
LOG.log(Level.FINER, "beforeCreate(): finished: {0}", file); // NOI18N |
137 |
LOG.log(Level.FINER, "beforeCreate(): finished: {0}", file); // NOI18N |
131 |
} |
138 |
} |
Lines 158-166
Link Here
|
158 |
if (file == null) return; |
165 |
if (file == null) return; |
159 |
Git git = Git.getInstance(); |
166 |
Git git = Git.getInstance(); |
160 |
File root = git.getRepositoryRoot(file); |
167 |
File root = git.getRepositoryRoot(file); |
|
|
168 |
GitClient client = null; |
161 |
try { |
169 |
try { |
162 |
if (GitUtils.getGitFolderForRoot(root).exists()) { |
170 |
if (GitUtils.getGitFolderForRoot(root).exists()) { |
163 |
git.getClient(root).remove(new File[] { file }, false, GitUtils.NULL_PROGRESS_MONITOR); |
171 |
client = git.getClient(root); |
|
|
172 |
client.remove(new File[] { file }, false, GitUtils.NULL_PROGRESS_MONITOR); |
164 |
} else if (file.exists()) { |
173 |
} else if (file.exists()) { |
165 |
Utils.deleteRecursively(file); |
174 |
Utils.deleteRecursively(file); |
166 |
if (file.exists()) { |
175 |
if (file.exists()) { |
Lines 178-183
Link Here
|
178 |
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(FilesystemInterceptor.class, "MSG_DeleteFailed", new Object[] { file, e.getLocalizedMessage() })); //NOI18N |
187 |
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(FilesystemInterceptor.class, "MSG_DeleteFailed", new Object[] { file, e.getLocalizedMessage() })); //NOI18N |
179 |
ex.initCause(e); |
188 |
ex.initCause(e); |
180 |
throw ex; |
189 |
throw ex; |
|
|
190 |
} finally { |
191 |
if (client != null) { |
192 |
client.release(); |
193 |
} |
181 |
} |
194 |
} |
182 |
} |
195 |
} |
183 |
|
196 |
|
Lines 207-223
Link Here
|
207 |
Git git = Git.getInstance(); |
220 |
Git git = Git.getInstance(); |
208 |
File root = git.getRepositoryRoot(from); |
221 |
File root = git.getRepositoryRoot(from); |
209 |
File dstRoot = git.getRepositoryRoot(to); |
222 |
File dstRoot = git.getRepositoryRoot(to); |
|
|
223 |
GitClient client = null; |
210 |
try { |
224 |
try { |
211 |
if (root != null && root.equals(dstRoot) && !cache.getStatus(to).containsStatus(Status.NOTVERSIONED_EXCLUDED)) { |
225 |
if (root != null && root.equals(dstRoot) && !cache.getStatus(to).containsStatus(Status.NOTVERSIONED_EXCLUDED)) { |
212 |
// target does not lie under ignored folder and is in the same repo as src |
226 |
// target does not lie under ignored folder and is in the same repo as src |
|
|
227 |
client = git.getClient(root); |
213 |
if (equalPathsIgnoreCase(from, to)) { |
228 |
if (equalPathsIgnoreCase(from, to)) { |
214 |
// must do rename --after because the files/paths equal on Win or Mac |
229 |
// must do rename --after because the files/paths equal on Win or Mac |
215 |
if (!from.renameTo(to)) { |
230 |
if (!from.renameTo(to)) { |
216 |
throw new IOException(NbBundle.getMessage(FilesystemInterceptor.class, "MSG_MoveFailed", new Object[] { from, to, "" })); //NOI18N |
231 |
throw new IOException(NbBundle.getMessage(FilesystemInterceptor.class, "MSG_MoveFailed", new Object[] { from, to, "" })); //NOI18N |
217 |
} |
232 |
} |
218 |
git.getClient(root).rename(from, to, true, GitUtils.NULL_PROGRESS_MONITOR); |
233 |
client.rename(from, to, true, GitUtils.NULL_PROGRESS_MONITOR); |
219 |
} else { |
234 |
} else { |
220 |
git.getClient(root).rename(from, to, false, GitUtils.NULL_PROGRESS_MONITOR); |
235 |
client.rename(from, to, false, GitUtils.NULL_PROGRESS_MONITOR); |
221 |
} |
236 |
} |
222 |
} else { |
237 |
} else { |
223 |
boolean result = from.renameTo(to); |
238 |
boolean result = from.renameTo(to); |
Lines 225-231
Link Here
|
225 |
throw new IOException(NbBundle.getMessage(FilesystemInterceptor.class, "MSG_MoveFailed", new Object[] { from, to, "" })); //NOI18N |
240 |
throw new IOException(NbBundle.getMessage(FilesystemInterceptor.class, "MSG_MoveFailed", new Object[] { from, to, "" })); //NOI18N |
226 |
} |
241 |
} |
227 |
if (root != null) { |
242 |
if (root != null) { |
228 |
git.getClient(root).remove(new File[] { from }, true, GitUtils.NULL_PROGRESS_MONITOR); |
243 |
client = git.getClient(root); |
|
|
244 |
client.remove(new File[] { from }, true, GitUtils.NULL_PROGRESS_MONITOR); |
229 |
} |
245 |
} |
230 |
} |
246 |
} |
231 |
} catch (GitException e) { |
247 |
} catch (GitException e) { |
Lines 233-238
Link Here
|
233 |
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(FilesystemInterceptor.class, "MSG_MoveFailed", new Object[] { from, to, e.getLocalizedMessage() })); //NOI18N |
249 |
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(FilesystemInterceptor.class, "MSG_MoveFailed", new Object[] { from, to, e.getLocalizedMessage() })); //NOI18N |
234 |
ex.initCause(e); |
250 |
ex.initCause(e); |
235 |
throw ex; |
251 |
throw ex; |
|
|
252 |
} finally { |
253 |
if (client != null) { |
254 |
client.release(); |
255 |
} |
236 |
} |
256 |
} |
237 |
} |
257 |
} |
238 |
|
258 |
|
Lines 283-297
Link Here
|
283 |
// target lies under ignored folder, do not add it |
303 |
// target lies under ignored folder, do not add it |
284 |
return; |
304 |
return; |
285 |
} |
305 |
} |
|
|
306 |
GitClient client = null; |
286 |
try { |
307 |
try { |
287 |
if (root.equals(dstRoot)) { |
308 |
if (root.equals(dstRoot)) { |
288 |
git.getClient(root).copyAfter(from, to, GitUtils.NULL_PROGRESS_MONITOR); |
309 |
client = git.getClient(root); |
|
|
310 |
client.copyAfter(from, to, GitUtils.NULL_PROGRESS_MONITOR); |
289 |
} |
311 |
} |
290 |
} catch (GitException e) { |
312 |
} catch (GitException e) { |
291 |
IOException ex = new IOException(); |
313 |
IOException ex = new IOException(); |
292 |
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(FilesystemInterceptor.class, "MSG_CopyFailed", new Object[] { from, to, e.getLocalizedMessage() })); //NOI18N |
314 |
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(FilesystemInterceptor.class, "MSG_CopyFailed", new Object[] { from, to, e.getLocalizedMessage() })); //NOI18N |
293 |
ex.initCause(e); |
315 |
ex.initCause(e); |
294 |
throw ex; |
316 |
throw ex; |
|
|
317 |
} finally { |
318 |
if (client != null) { |
319 |
client.release(); |
320 |
} |
295 |
} |
321 |
} |
296 |
} |
322 |
} |
297 |
|
323 |
|