@Override
	public Result getRevision () {
		List<Integer> parents = getParentsImpl();
		
		if (parents.size() == 0) {
			// new repository
			return new Result(0, null);
		}
		
		final String branch = getBranchImpl();
		
		// get all revisions that are not ancestors of the parent revisions
		// i.e. all revisions not yet integrated into current revision
		List<String> lines;
		if (parents.size() == 1) {
			int p0 = parents.get(0);
			lines = runHg("log", "-b", branch, "-P", "" + p0, "--template", "{rev},{files}\\n");
			
		} else {
			int p0 = parents.get(0);
			int p1 = parents.get(1);
			lines = runHg("log", "-b", branch, "-P", "" + p0, "-P", "" + p1, "--template", "{rev},{files}\\n");
		}
		
		int aborts = countStartsWith(lines, ABORT_PREFIX);
		if (aborts > 0) {
			return new Result("abort", firstStartsWith(lines, ABORT_PREFIX), true);
		}
		
		final Set<Integer> changesets = new TreeSet<>();
		final Set<String> files = new TreeSet<>();
		
		for (String line : lines) {
			String[] a = line.split(",");
			int r = Integer.parseInt(a[0]);
			changesets.add(r);
			// may not be any files
			if (a.length > 1) {
				String[] f = a[1].split(" ");
				files.addAll(Arrays.asList(f));
			}
		}
		
		if (changesets.size() > 0) {
			String msg = String.format("%d changesets and %d files not up to date", changesets.size(), files.size());
			return new Result(-changesets.size(), msg, true);
			
		} else {
			return new Result(0, null);
		}
	}