Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/HgCloneCommand.java @ 608:e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 07 May 2013 21:27:51 +0200 |
parents | e4ee4bf4c7d0 |
children | 5e0313485eef |
rev | line source |
---|---|
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
2 * Copyright (c) 2011-2013 TMate Software Ltd |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 import static org.tmatesoft.hg.core.Nodeid.NULL; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 import static org.tmatesoft.hg.internal.RequiresFile.*; |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
21 import static org.tmatesoft.hg.internal.RevlogStreamWriter.preferCompleteOverPatch; |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
22 import static org.tmatesoft.hg.internal.RevlogStreamWriter.preferCompressedOverComplete; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import java.io.File; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 import java.io.FileOutputStream; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import java.io.IOException; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import java.util.ArrayList; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import java.util.Collections; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 import java.util.TreeMap; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 import org.tmatesoft.hg.internal.ByteArrayDataAccess; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 import org.tmatesoft.hg.internal.DataAccess; |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
33 import org.tmatesoft.hg.internal.DataAccessProvider; |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
34 import org.tmatesoft.hg.internal.DataSerializer; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 import org.tmatesoft.hg.internal.DigestHelper; |
539
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
36 import org.tmatesoft.hg.internal.FNCacheFile; |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
37 import org.tmatesoft.hg.internal.Internals; |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
38 import org.tmatesoft.hg.internal.Lifecycle; |
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:
431
diff
changeset
|
39 import org.tmatesoft.hg.internal.RepoInitializer; |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
40 import org.tmatesoft.hg.internal.RevlogCompressor; |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
41 import org.tmatesoft.hg.internal.RevlogStreamWriter; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 import org.tmatesoft.hg.repo.HgBundle; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 import org.tmatesoft.hg.repo.HgBundle.GroupElement; |
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:
418
diff
changeset
|
44 import org.tmatesoft.hg.repo.HgInvalidControlFileException; |
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:
418
diff
changeset
|
45 import org.tmatesoft.hg.repo.HgInvalidFileException; |
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:
418
diff
changeset
|
46 import org.tmatesoft.hg.repo.HgInvalidStateException; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 import org.tmatesoft.hg.repo.HgLookup; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 import org.tmatesoft.hg.repo.HgRemoteRepository; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 import org.tmatesoft.hg.repo.HgRepository; |
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:
418
diff
changeset
|
50 import org.tmatesoft.hg.repo.HgRuntimeException; |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
51 import org.tmatesoft.hg.util.CancelSupport; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 import org.tmatesoft.hg.util.CancelledException; |
539
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
53 import org.tmatesoft.hg.util.Path; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 import org.tmatesoft.hg.util.PathRewrite; |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
55 import org.tmatesoft.hg.util.ProgressSupport; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 /** |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 * WORK IN PROGRESS, DO NOT USE |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 * |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
60 * @author Artem Tikhomirov |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 * @author TMate Software Ltd. |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 */ |
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:
418
diff
changeset
|
63 public class HgCloneCommand extends HgAbstractCommand<HgCloneCommand> { |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 private File destination; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 private HgRemoteRepository srcRepo; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 public HgCloneCommand() { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 |
204
883f1efbcf27
Add clone,incoming and outging tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
71 /** |
883f1efbcf27
Add clone,incoming and outging tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
72 * @param folder location to become root of the repository (i.e. where <em>.hg</em> folder would reside). Either |
883f1efbcf27
Add clone,incoming and outging tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
73 * shall not exist or be empty otherwise. |
883f1efbcf27
Add clone,incoming and outging tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
74 * @return <code>this</code> for convenience |
883f1efbcf27
Add clone,incoming and outging tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
75 */ |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 public HgCloneCommand destination(File folder) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 destination = folder; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 return this; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
79 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
80 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 public HgCloneCommand source(HgRemoteRepository hgRemote) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 srcRepo = hgRemote; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 return this; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
84 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
85 |
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:
418
diff
changeset
|
86 /** |
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:
418
diff
changeset
|
87 * |
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:
418
diff
changeset
|
88 * @return |
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:
418
diff
changeset
|
89 * @throws HgBadArgumentException |
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:
418
diff
changeset
|
90 * @throws HgRemoteConnectionException |
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:
418
diff
changeset
|
91 * @throws HgRepositoryNotFoundException |
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:
418
diff
changeset
|
92 * @throws HgException |
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:
418
diff
changeset
|
93 * @throws CancelledException |
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:
418
diff
changeset
|
94 * @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:
418
diff
changeset
|
95 */ |
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:
418
diff
changeset
|
96 public HgRepository execute() throws HgException, CancelledException { |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
97 if (destination == null) { |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
98 throw new IllegalArgumentException("Destination not set", null); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
99 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
100 if (srcRepo == null || srcRepo.isInvalid()) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
101 throw new HgBadArgumentException("Bad source repository", null); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
102 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
103 if (destination.exists()) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
104 if (!destination.isDirectory()) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
105 throw new HgBadArgumentException(String.format("%s is not a directory", destination), null); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
106 } else if (destination.list().length > 0) { |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
107 throw new HgBadArgumentException(String.format("%s shall be empty", destination), null); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
108 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
109 } else { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 destination.mkdirs(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
111 } |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
112 ProgressSupport progress = getProgressSupport(null); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
113 CancelSupport cancel = getCancelSupport(null, true); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
114 cancel.checkCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
115 // if cloning remote repo, which can stream and no revision is specified - |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
116 // can use 'stream_out' wireproto |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
117 // |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
118 // pull all changes from the very beginning |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
119 // XXX consult getContext() if by any chance has a bundle ready, if not, then read and register |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
120 HgBundle completeChanges = srcRepo.getChanges(Collections.singletonList(NULL)); |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
121 cancel.checkCancelled(); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
122 WriteDownMate mate = new WriteDownMate(srcRepo.getSessionContext(), destination, progress, cancel); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
123 try { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
124 // instantiate new repo in the destdir |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
125 mate.initEmptyRepository(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
126 // pull changes |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
127 completeChanges.inspectAll(mate); |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
128 mate.checkFailure(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
129 mate.complete(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
130 } catch (IOException ex) { |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
131 throw new HgInvalidFileException(getClass().getName(), ex); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
132 } finally { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
133 completeChanges.unlink(); |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
134 progress.done(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
135 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
136 return new HgLookup().detect(destination); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
137 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
138 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
139 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
140 // 1. process changelog, memorize nodeids to index |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
141 // 2. process manifest, using map from step 3, collect manifest nodeids |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
142 // 3. process every file, using map from 3, and consult set from step 4 to ensure repo is correct |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
143 private static class WriteDownMate implements HgBundle.Inspector, Lifecycle { |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
144 private final File hgDir; |
190
9b99d27aeddc
More debug printouts
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
186
diff
changeset
|
145 private final PathRewrite storagePathHelper; |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
146 private final ProgressSupport progressSupport; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
147 private final CancelSupport cancelSupport; |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
148 private final SessionContext ctx; |
571
e4ee4bf4c7d0
Let session context control creation of Path instances
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
539
diff
changeset
|
149 private final Path.Source pathFactory; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
150 private FileOutputStream indexFile; |
190
9b99d27aeddc
More debug printouts
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
186
diff
changeset
|
151 private String filename; // human-readable name of the file being written, for log/exception purposes |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
152 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
153 private final TreeMap<Nodeid, Integer> changelogIndexes = new TreeMap<Nodeid, Integer>(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
154 private boolean collectChangelogIndexes = false; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
155 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
156 private DataAccess prevRevContent; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
157 private final DigestHelper dh = new DigestHelper(); |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
158 // recently processed nodes last, so that index in the array may be used as a linkRevision or baseRevision |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
159 private final ArrayList<Nodeid> revisionSequence = new ArrayList<Nodeid>(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
160 |
539
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
161 private FNCacheFile fncacheFile; |
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:
431
diff
changeset
|
162 private RepoInitializer repoInit; |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
163 private Lifecycle.Callback lifecycleCallback; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
164 private CancelledException cancelException; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
165 |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
166 private RevlogStreamWriter.HeaderWriter revlogHeader = new RevlogStreamWriter.HeaderWriter(true); |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
167 private RevlogCompressor revlogDataZip; |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
168 |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
169 public WriteDownMate(SessionContext sessionCtx, File destDir, ProgressSupport progress, CancelSupport cancel) { |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
170 ctx = sessionCtx; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
171 hgDir = new File(destDir, ".hg"); |
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:
431
diff
changeset
|
172 repoInit = new RepoInitializer(); |
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:
431
diff
changeset
|
173 repoInit.setRequires(STORE | FNCACHE | DOTENCODE); |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
174 storagePathHelper = repoInit.buildDataFilesHelper(sessionCtx); |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
175 progressSupport = progress; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
176 cancelSupport = cancel; |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
177 revlogDataZip = new RevlogCompressor(sessionCtx); |
571
e4ee4bf4c7d0
Let session context control creation of Path instances
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
539
diff
changeset
|
178 pathFactory = ctx.getPathFactory(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
179 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
180 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
181 public void initEmptyRepository() throws IOException { |
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:
431
diff
changeset
|
182 repoInit.initEmptyRepository(hgDir); |
539
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
183 try { |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
184 assert (repoInit.getRequires() & FNCACHE) != 0; |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
185 fncacheFile = new FNCacheFile(Internals.getInstance(new HgLookup(ctx).detect(hgDir))); |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
186 } catch (HgRepositoryNotFoundException ex) { |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
187 // SHALL NOT HAPPEN provided we initialized empty repository successfully |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
188 // TODO perhaps, with WriteDownMate moving to a more appropriate location, |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
189 // we could instantiate HgRepository (or Internals) by other means, without exception? |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
190 throw new IOException("Can't access fncache for newly created repository", ex); |
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
191 } |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
192 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
193 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
194 public void complete() throws IOException { |
539
9edfd5a223b8
Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
534
diff
changeset
|
195 fncacheFile.write(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
196 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
197 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
198 public void changelogStart() { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
199 try { |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
200 revlogHeader.offset(0).baseRevision(-1); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
201 revisionSequence.clear(); |
190
9b99d27aeddc
More debug printouts
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
186
diff
changeset
|
202 indexFile = new FileOutputStream(new File(hgDir, filename = "store/00changelog.i")); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
203 collectChangelogIndexes = true; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
204 } catch (IOException ex) { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
205 throw new HgInvalidControlFileException("Failed to write changelog", ex, new File(hgDir, filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
206 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
207 stopIfCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
208 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
209 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
210 public void changelogEnd() { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
211 try { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
212 clearPreviousContent(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
213 collectChangelogIndexes = false; |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
214 closeIndexFile(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
215 } catch (IOException ex) { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
216 throw new HgInvalidControlFileException("Failed to write changelog", ex, new File(hgDir, filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
217 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
218 progressSupport.worked(1); |
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
219 stopIfCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
220 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
221 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
222 public void manifestStart() { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
223 try { |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
224 revlogHeader.offset(0).baseRevision(-1); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
225 revisionSequence.clear(); |
190
9b99d27aeddc
More debug printouts
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
186
diff
changeset
|
226 indexFile = new FileOutputStream(new File(hgDir, filename = "store/00manifest.i")); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
227 } catch (IOException ex) { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
228 throw new HgInvalidControlFileException("Failed to write manifest", ex, new File(hgDir, filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
229 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
230 stopIfCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
231 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
232 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
233 public void manifestEnd() { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
234 try { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
235 clearPreviousContent(); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
236 closeIndexFile(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
237 } catch (IOException ex) { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
238 throw new HgInvalidControlFileException("Failed to write manifest", ex, new File(hgDir, filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
239 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
240 progressSupport.worked(1); |
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
241 stopIfCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
242 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
243 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
244 public void fileStart(String name) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
245 try { |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
246 revlogHeader.offset(0).baseRevision(-1); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
247 revisionSequence.clear(); |
571
e4ee4bf4c7d0
Let session context control creation of Path instances
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
539
diff
changeset
|
248 fncacheFile.add(pathFactory.path(name)); |
292
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
274
diff
changeset
|
249 File file = new File(hgDir, filename = storagePathHelper.rewrite(name).toString()); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
250 file.getParentFile().mkdirs(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
251 indexFile = new FileOutputStream(file); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
252 } catch (IOException ex) { |
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:
418
diff
changeset
|
253 String m = String.format("Failed to write file %s", filename); |
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:
418
diff
changeset
|
254 throw new HgInvalidControlFileException(m, ex, new File(filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
255 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
256 stopIfCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
257 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
258 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
259 public void fileEnd(String name) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
260 try { |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
261 clearPreviousContent(); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
262 closeIndexFile(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
263 } catch (IOException ex) { |
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:
418
diff
changeset
|
264 String m = String.format("Failed to write file %s", filename); |
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:
418
diff
changeset
|
265 throw new HgInvalidControlFileException(m, ex, new File(filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
266 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
267 progressSupport.worked(1); |
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
268 stopIfCancelled(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
269 } |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
270 |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
271 private void clearPreviousContent() { |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
272 if (prevRevContent != null) { |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
273 prevRevContent.done(); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
274 prevRevContent = null; |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
275 } |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
276 } |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
277 |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
278 private void closeIndexFile() throws IOException { |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
279 indexFile.close(); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
280 indexFile = null; |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
281 filename = null; |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
282 } |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
283 |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
284 private int knownRevision(Nodeid p) { |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
204
diff
changeset
|
285 if (p.isNull()) { |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
286 return -1; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
287 } else { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
288 for (int i = revisionSequence.size() - 1; i >= 0; i--) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
289 if (revisionSequence.get(i).equals(p)) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
290 return i; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
291 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
292 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
293 } |
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:
418
diff
changeset
|
294 String m = String.format("Can't find index of %s for file %s", p.shortNotation(), filename); |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
295 throw new HgInvalidControlFileException(m, null, new File(hgDir, filename)).setRevision(p); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
296 } |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
297 |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
298 public boolean element(GroupElement ge) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
299 try { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
300 assert indexFile != null; |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
301 boolean writeComplete = false; |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
302 Nodeid deltaBase = ge.patchBase(); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
303 if (deltaBase.isNull()) { |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
304 // NOTE, can't use both parents isNull == true to empty prevRevContent |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
305 // see build.gradle sample below why. |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
306 prevRevContent = new DataAccess(); // empty data |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
307 writeComplete = true; |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
308 // if (writeComplete) would set baseRevision correctly, |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
309 } else { |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
310 Nodeid prevRevision = revisionSequence.size() > 0 ? revisionSequence.get(revisionSequence.size()-1) : Nodeid.NULL; |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
311 if (!prevRevision.equals(deltaBase)) { |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
312 // presently, bundle group elements always patch previous, see |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
313 // (a) changegroup.py#builddeltaheader(): # do nothing with basenode, it is implicitly the previous one in HG10 |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
314 // (b) revlog.py#group(): prev, curr = revs[r], revs[r + 1] |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
315 // for c in bundler.revchunk(self, curr, prev): |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
316 // so there's no reason to have code here to extract contents of deltaBase revision |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
317 String m = String.format("Revision %s import failed: delta base %s is not the last node we've handled (and know content for) %s", ge.node(), deltaBase, prevRevision); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
318 throw new HgInvalidStateException(m); |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
319 } |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
320 } |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
321 // |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
322 byte[] content = ge.apply(prevRevContent.byteArray()); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
323 Nodeid p1 = ge.firstParent(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
324 Nodeid p2 = ge.secondParent(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
325 byte[] calculated = dh.sha1(p1, p2, content).asBinary(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
326 final Nodeid node = ge.node(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
327 if (!node.equalsTo(calculated)) { |
531
95c2f43008bd
Throw specific exception when checksum calculation fails
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
530
diff
changeset
|
328 String m = String.format("Checksum failed: expected %s, calculated %s. File %s", node, calculated, filename); |
95c2f43008bd
Throw specific exception when checksum calculation fails
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
530
diff
changeset
|
329 throw new HgRevisionIntegrityException(m, null, new File(hgDir, filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
330 } |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
331 revlogHeader.nodeid(node); |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
332 // |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
333 if (collectChangelogIndexes) { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
334 changelogIndexes.put(node, revisionSequence.size()); |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
335 revlogHeader.linkRevision(revisionSequence.size()); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
336 } else { |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
337 Integer csRev = changelogIndexes.get(ge.cset()); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
338 if (csRev == null) { |
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:
418
diff
changeset
|
339 throw new HgInvalidStateException(String.format("Changelog doesn't contain revision %s of %s", ge.cset().shortNotation(), filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
340 } |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
341 revlogHeader.linkRevision(csRev.intValue()); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
342 } |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
343 // |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
344 revlogHeader.parents(knownRevision(p1), knownRevision(p2)); |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
345 // |
358
fc8bc2f1edbe
Clean internal classes from public API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
346 byte[] patchContent = ge.rawDataByteArray(); |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
347 // no reason to keep patch if it's close (here, >75%) in size to the complete contents, |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
348 // save patching effort in this case |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
349 writeComplete = writeComplete || preferCompleteOverPatch(patchContent.length, content.length); |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
350 |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
351 if (writeComplete) { |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
352 revlogHeader.baseRevision(revisionSequence.size()); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
353 } |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
354 assert revlogHeader.baseRevision() >= 0; |
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
355 |
358
fc8bc2f1edbe
Clean internal classes from public API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
356 final byte[] sourceData = writeComplete ? content : patchContent; |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
357 revlogDataZip.reset(new DataSerializer.ByteArrayDataSource(sourceData)); |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
358 final int compressedLen; |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
359 final boolean useUncompressedData = preferCompressedOverComplete(revlogDataZip.getCompressedLength(), sourceData.length); |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
360 if (useUncompressedData) { |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
361 // compression wasn't too effective, |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
362 compressedLen = sourceData.length + 1 /*1 byte for 'u' - uncompressed prefix byte*/; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
363 } else { |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
364 compressedLen= revlogDataZip.getCompressedLength(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
365 } |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
366 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
367 revlogHeader.length(content.length, compressedLen); |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
368 |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
369 // XXX may be wise not to create DataSerializer for each revision, but for a file |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
370 DataAccessProvider.StreamDataSerializer sds = new DataAccessProvider.StreamDataSerializer(ctx.getLog(), indexFile) { |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
371 @Override |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
372 public void done() { |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
373 // override parent behavior not to close stream in use |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
374 } |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
375 }; |
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
376 revlogHeader.serialize(sds); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
377 |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
378 if (useUncompressedData) { |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
379 indexFile.write((byte) 'u'); |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
380 indexFile.write(sourceData); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
381 } else { |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
382 int actualCompressedLenWritten = revlogDataZip.writeCompressedData(sds); |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
383 if (actualCompressedLenWritten != compressedLen) { |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
384 throw new HgInvalidStateException(String.format("Expected %d bytes of compressed data, but actually wrote %d in %s", compressedLen, actualCompressedLenWritten, filename)); |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
385 } |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
386 } |
534
243202f1bda5
Commit: refactor revision creation code from clone command to work separately, fit into existing library structure
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
532
diff
changeset
|
387 sds.done(); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
388 // |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
389 revisionSequence.add(node); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
390 prevRevContent.done(); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
391 prevRevContent = new ByteArrayDataAccess(content); |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
392 } catch (IOException ex) { |
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:
418
diff
changeset
|
393 String m = String.format("Failed to write revision %s of file %s", ge.node().shortNotation(), filename); |
531
95c2f43008bd
Throw specific exception when checksum calculation fails
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
530
diff
changeset
|
394 throw new HgInvalidControlFileException(m, ex, new File(hgDir, filename)); |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
395 } |
513
a41d955dc360
Issue 39: HgCloneCommand doesn't use CancelSupport/ProgressSupport handlers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
512
diff
changeset
|
396 return cancelException == null; |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
397 } |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
398 /* |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
399 $ hg debugindex build.gradle |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
400 rev offset length base linkrev nodeid p1 p2 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
401 0 0 857 0 454 b2a1b20d1933 000000000000 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
402 1 857 319 0 455 5324c8f2b550 b2a1b20d1933 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
403 2 1176 533 0 460 4011d52141cd 5324c8f2b550 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
404 3 1709 85 0 463 d0be58845306 4011d52141cd 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
405 4 1794 105 0 464 3ddd456244a0 d0be58845306 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
406 5 1899 160 0 466 a3f374fbf33a 3ddd456244a0 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
407 6 2059 133 0 468 0227d28e0db6 a3f374fbf33a 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
408 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
409 once we get a bundle for this repository and look into it for the same file: |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
410 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
411 $hg debugbundle -a /tmp/hg-bundle-4418325145435980614.tmp |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
412 format: id, p1, p2, cset, delta base, len(delta) |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
413 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
414 build.gradle |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
415 62a101b7994c6c5b0423ba6c802f8c64d24ef784 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6ec4af642ba8024edd636af15e672c97cc3294e4 0000000000000000000000000000000000000000 1368 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
416 b2a1b20d1933d0605aab6780ee52fe5ab3073832 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 7dcc920e2d57d5850ee9f08ac863251460565bd3 62a101b7994c6c5b0423ba6c802f8c64d24ef784 2373 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
417 5324c8f2b5503a4d1ead3ac40a9851c27572166b b2a1b20d1933d0605aab6780ee52fe5ab3073832 0000000000000000000000000000000000000000 7b883bf03b14ccea8ee74db0a34f9f66ca644a3c b2a1b20d1933d0605aab6780ee52fe5ab3073832 579 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
418 4011d52141cd717c92cbf350a93522d2f3ee415e 5324c8f2b5503a4d1ead3ac40a9851c27572166b 0000000000000000000000000000000000000000 55e9588b84b83aa96fe76a06ee8bf067c5d3c90e 5324c8f2b5503a4d1ead3ac40a9851c27572166b 1147 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
419 d0be588453068787dcb3ee05f8edfe47fdd5ae78 4011d52141cd717c92cbf350a93522d2f3ee415e 0000000000000000000000000000000000000000 ad0322a4af204547c400e1846b2b83d446ab8da5 4011d52141cd717c92cbf350a93522d2f3ee415e 85 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
420 3ddd456244a08f81779163d9faf922a6dcd9e53e d0be588453068787dcb3ee05f8edfe47fdd5ae78 0000000000000000000000000000000000000000 3ace1fc95d0a1a941b6427c60b6e624f96dd71ad d0be588453068787dcb3ee05f8edfe47fdd5ae78 151 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
421 a3f374fbf33aba1cc3b4f472db022b5185880f5d 3ddd456244a08f81779163d9faf922a6dcd9e53e 0000000000000000000000000000000000000000 3ca4ae7bdd3890b8ed89bfea1b42af593e04b373 3ddd456244a08f81779163d9faf922a6dcd9e53e 195 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
422 0227d28e0db69afebee34cd5a4151889fb6271da a3f374fbf33aba1cc3b4f472db022b5185880f5d 0000000000000000000000000000000000000000 31bd09da0dcfe48e1fc662143f91ff402238aa84 a3f374fbf33aba1cc3b4f472db022b5185880f5d 145 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
423 |
532
688c1ab113bb
Introduce explicit reference to base patch in bundle's group element, use it when cloning to fix defect when few revisions list null,null parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
531
diff
changeset
|
424 but there's no delta base information in the bundle file, it's merely a hard-coded convention |
530
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
425 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
426 It's unclear where the first chunk (identified 62a101b7...) comes from (by the way, there's no such changeset as 6ec4af... as specified in the chunk, while 7dcc920e.. IS changeset 454) |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
427 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
428 EXPLANATION: |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
429 if cloned repository comes from svnkit repo (where's the gradle branch): |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
430 $hg debugindex build.gradle |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
431 rev offset length base linkrev nodeid p1 p2 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
432 0 0 590 0 213 62a101b7994c 000000000000 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
433 1 590 872 0 452 b2a1b20d1933 000000000000 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
434 2 1462 319 0 453 5324c8f2b550 b2a1b20d1933 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
435 3 1781 533 0 459 4011d52141cd 5324c8f2b550 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
436 4 2314 85 0 462 d0be58845306 4011d52141cd 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
437 5 2399 105 0 466 3ddd456244a0 d0be58845306 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
438 6 2504 160 0 468 a3f374fbf33a 3ddd456244a0 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
439 7 2664 133 0 470 0227d28e0db6 a3f374fbf33a 000000000000 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
440 |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
441 and the aforementioned bundle was result of hg incoming svnkit!!! |
0f6fa88e2162
Towards commit command: refactor clone, extract pieces to reuse. Describe a defect discovered when bundle has few patches with 0,0 parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
513
diff
changeset
|
442 */ |
512
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
443 |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
444 public void start(int count, Callback callback, Object token) { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
445 progressSupport.start(count); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
446 lifecycleCallback = callback; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
447 } |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
448 |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
449 public void finish(Object token) { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
450 progressSupport.done(); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
451 lifecycleCallback = null; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
452 } |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
453 |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
454 public void checkFailure() throws CancelledException { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
455 if (cancelException != null) { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
456 throw cancelException; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
457 } |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
458 } |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
459 |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
460 private void stopIfCancelled() { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
461 try { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
462 cancelSupport.checkCancelled(); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
463 return; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
464 } catch (CancelledException ex) { |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
465 cancelException = ex; |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
466 lifecycleCallback.stop(); |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
467 } |
10ca3ede8367
Issue 39: Progress and Cancel support for Clone command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
468 } |
186
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
469 } |
44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
470 } |