comparison src/org/tmatesoft/hg/repo/HgPhase.java @ 445:d0e5dc3cae6e smartgit3

Support for phases functionality from Mercurial 2.1
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Jun 2012 20:50:06 +0200
parents
children 09f2d38ecf26
comparison
equal deleted inserted replaced
412:63c5a9d7ca3f 445:d0e5dc3cae6e
1 /*
2 * Copyright (c) 2012 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.repo;
18
19 /**
20 * Phases for a changeset is a new functionality in Mercurial 2.1
21 *
22 * @author Artem Tikhomirov
23 * @author TMate Software Ltd.
24 */
25 public enum HgPhase {
26
27 Public("public"), Draft("draft"), Secret("secret"), Undefined("");
28
29 @SuppressWarnings("unused")
30 private final String hgString;
31
32 private HgPhase(String stringRepresentation) {
33 hgString = stringRepresentation;
34 }
35
36 // public String toMercurialString() {
37 // return hgString;
38 // }
39
40 public static HgPhase parse(int value) {
41 switch (value) {
42 case 0 : return Public;
43 case 1 : return Draft;
44 case 2 : return Secret;
45 }
46 throw new IllegalArgumentException(String.format("Bad phase index: %d", value));
47 }
48 }