Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgRepoFacade.java @ 131:aa1629f36482
Renamed .core classes to start with Hg prefix
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 16 Feb 2011 20:47:56 +0100 |
parents | src/org/tmatesoft/hg/core/RepositoryFacade.java@c0cc2535462c |
children | b9700740553a |
comparison
equal
deleted
inserted
replaced
130:7567f4a42fe5 | 131:aa1629f36482 |
---|---|
1 /* | |
2 * Copyright (c) 2011 TMate Software Ltd | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; version 2 of the License. | |
7 * | |
8 * This program is distributed in the hope that it will be useful, | |
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 * GNU General Public License for more details. | |
12 * | |
13 * For information on how to redistribute this software under | |
14 * the terms of a license other than GNU General Public License | |
15 * contact TMate Software at support@hg4j.com | |
16 */ | |
17 package org.tmatesoft.hg.core; | |
18 | |
19 import java.io.File; | |
20 | |
21 import org.tmatesoft.hg.repo.HgRepository; | |
22 import org.tmatesoft.hg.repo.HgLookup; | |
23 | |
24 /** | |
25 * Starting point for the library. | |
26 * | |
27 * @author Artem Tikhomirov | |
28 * @author TMate Software Ltd. | |
29 */ | |
30 public class HgRepoFacade { | |
31 private HgRepository repo; | |
32 | |
33 public HgRepoFacade() { | |
34 } | |
35 | |
36 public boolean init() throws Exception /*FIXME RepoInitException*/ { | |
37 repo = new HgLookup().detectFromWorkingDir(); | |
38 return repo != null && !repo.isInvalid(); | |
39 } | |
40 | |
41 public boolean initFrom(File repoLocation) throws Exception { | |
42 repo = new HgLookup().detect(repoLocation.getCanonicalPath()); | |
43 return repo != null && !repo.isInvalid(); | |
44 } | |
45 | |
46 public HgRepository getRepository() { | |
47 if (repo == null) { | |
48 throw new IllegalStateException("Call any of #init*() methods first first"); | |
49 } | |
50 return repo; | |
51 } | |
52 | |
53 public HgLogCommand createLogCommand() { | |
54 return new HgLogCommand(repo/*, getCommandContext()*/); | |
55 } | |
56 | |
57 public HgStatusCommand createStatusCommand() { | |
58 return new HgStatusCommand(repo/*, getCommandContext()*/); | |
59 } | |
60 | |
61 public HgCatCommand createCatCommand() { | |
62 return new HgCatCommand(repo); | |
63 } | |
64 | |
65 public HgManifestCommand createManifestCommand() { | |
66 return new HgManifestCommand(repo); | |
67 } | |
68 } |