Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgCloneCommand.java @ 295:981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Sep 2011 05:35:32 +0200 |
parents | a415fe296a50 |
children | fc8bc2f1edbe |
comparison
equal
deleted
inserted
replaced
294:32890bab7209 | 295:981f9f50bb6c |
---|---|
69 public HgCloneCommand source(HgRemoteRepository hgRemote) { | 69 public HgCloneCommand source(HgRemoteRepository hgRemote) { |
70 srcRepo = hgRemote; | 70 srcRepo = hgRemote; |
71 return this; | 71 return this; |
72 } | 72 } |
73 | 73 |
74 public HgRepository execute() throws HgException, CancelledException { | 74 public HgRepository execute() throws HgBadArgumentException, HgRemoteConnectionException, HgInvalidFileException, CancelledException { |
75 if (destination == null) { | 75 if (destination == null) { |
76 throw new HgBadArgumentException("Destination not set", null); | 76 throw new IllegalArgumentException("Destination not set", null); |
77 } | 77 } |
78 if (srcRepo == null || srcRepo.isInvalid()) { | 78 if (srcRepo == null || srcRepo.isInvalid()) { |
79 throw new HgBadArgumentException("Bad source repository", null); | 79 throw new HgBadArgumentException("Bad source repository", null); |
80 } | 80 } |
81 if (destination.exists()) { | 81 if (destination.exists()) { |
99 mate.initEmptyRepository(); | 99 mate.initEmptyRepository(); |
100 // pull changes | 100 // pull changes |
101 completeChanges.inspectAll(mate); | 101 completeChanges.inspectAll(mate); |
102 mate.complete(); | 102 mate.complete(); |
103 } catch (IOException ex) { | 103 } catch (IOException ex) { |
104 throw new HgException(ex); | 104 throw new HgInvalidFileException(getClass().getName(), ex); |
105 } finally { | 105 } finally { |
106 completeChanges.unlink(); | 106 completeChanges.unlink(); |
107 } | 107 } |
108 return new HgLookup().detect(destination); | 108 return new HgLookup().detect(destination); |
109 } | 109 } |