示例#1
0
  /** Executes the map command using the provided options. */
  @Override
  protected void runInternal(GeogitCLI cli) throws IOException {

    if (args == null || args.isEmpty() || args.size() != 1) {
      printUsage(cli);
      throw new CommandFailedException();
    }

    String path = args.get(0);

    geogit = cli.getGeogit();

    ObjectId oldTreeId = geogit.getRepository().workingTree().getTree().getId();

    ObjectId newTreeId = geogit.command(OSMUnmapOp.class).setPath(path).call().getId();

    ConsoleReader console = cli.getConsole();
    if (newTreeId.equals(oldTreeId)) {
      console.println(
          "No differences were found after unmapping.\n"
              + "No changes have been made to the working tree");
    } else {
      // print something?
    }
  }
示例#2
0
  // two features with different content should point to different objects
  public void testInsertNonEqualObjects() throws Exception {
    ObjectId oId1 = insertAndAdd(points1);

    ObjectId oId2 = insertAndAdd(points2);
    assertNotNull(oId1);
    assertNotNull(oId2);
    assertFalse(oId1.equals(oId2));
  }
 @Override
 public T read(ObjectId id, InputStream rawData) throws IllegalArgumentException {
   try {
     BufferedReader reader;
     reader = new BufferedReader(new InputStreamReader(rawData, "UTF-8"));
     TYPE type = RevObject.TYPE.valueOf(requireLine(reader).trim());
     T parsed = read(id, reader, type);
     Preconditions.checkState(parsed != null, "parsed to null");
     if (id != null) {
       Preconditions.checkState(
           id.equals(parsed.getId()),
           "Expected and parsed object ids don't match: %s %s",
           id,
           parsed.getId());
     }
     return parsed;
   } catch (Exception e) {
     throw Throwables.propagate(e);
   }
 }