annotate src/org/tmatesoft/hg/core/RepositoryFacade.java @ 108:0c9804857000

Embellishments
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 29 Jan 2011 02:31:09 +0100
parents a3a2e5deb320
children c0cc2535462c
rev   line source
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2011 TMate Software Ltd
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
102
a3a2e5deb320 Updated contact address to support@hg4j.com
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 95
diff changeset
15 * contact TMate Software at support@hg4j.com
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.core;
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import java.io.File;
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 import org.tmatesoft.hg.repo.HgRepository;
95
bcd31a4c638a Lookup to HgLookup
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
22 import org.tmatesoft.hg.repo.HgLookup;
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 /**
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25 *
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 * @author Artem Tikhomirov
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 * @author TMate Software Ltd.
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 */
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 public class RepositoryFacade {
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 private HgRepository repo;
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 public RepositoryFacade() {
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 }
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 public boolean init() throws Exception /*FIXME RepoInitException*/ {
95
bcd31a4c638a Lookup to HgLookup
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
36 repo = new HgLookup().detectFromWorkingDir();
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 return repo != null && !repo.isInvalid();
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 }
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 public boolean initFrom(File repoLocation) throws Exception {
95
bcd31a4c638a Lookup to HgLookup
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
41 repo = new HgLookup().detect(repoLocation.getCanonicalPath());
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 return repo != null && !repo.isInvalid();
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 }
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 public LogCommand createLogCommand() {
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 return new LogCommand(repo/*, getCommandContext()*/);
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 }
108
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
48
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 public StatusCommand createStatusCommand() {
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 return new StatusCommand(repo/*, getCommandContext()*/);
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51 }
108
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
52
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
53 public CatCommand createCatCommand() {
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
54 return new CatCommand(repo);
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
55 }
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
56
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
57 public RepositoryTreeWalker createManifestCommand() {
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
58 return new RepositoryTreeWalker(repo);
0c9804857000 Embellishments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
59 }
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
60 }