@NotNull public Couple<HgRevisionNumber> identify(@NotNull VirtualFile repo){
  HgCommandExecutor commandExecutor=new HgCommandExecutor(myProject);
  commandExecutor.setSilent(true);
  HgCommandResult result=commandExecutor.executeInCurrentThread(repo,"identify",Arrays.asList("--num","--id"));
  if (result == null) {
    return Couple.of(HgRevisionNumber.NULL_REVISION_NUMBER,null);
  }
  final List<String> lines=result.getOutputLines();
  if (lines != null && !lines.isEmpty()) {
    List<String> parts=StringUtil.split(lines.get(0)," ");
    String changesets=parts.get(0);
    String revisions=parts.get(1);
    if (parts.size() >= 2) {
      if (changesets.indexOf('+') != changesets.lastIndexOf('+')) {
        List<String> chsets=StringUtil.split(changesets,"+");
        List<String> revs=StringUtil.split(revisions,"+");
        return Couple.of(HgRevisionNumber.getInstance(revs.get(0) + "+",chsets.get(0) + "+"),HgRevisionNumber.getInstance(revs.get(1) + "+",chsets.get(1) + "+"));
      }
 else {
        return Couple.of(HgRevisionNumber.getInstance(revisions,changesets),null);
      }
    }
  }
  return Couple.of(HgRevisionNumber.NULL_REVISION_NUMBER,null);
}

@ NotNull public Couple < HgRevisionNumber > identify ( @ NotNull VirtualFile repo ) { HgCommandExecutor commandExecutor = new HgCommandExecutor ( myProject ) ; commandExecutor . setSilent ( true ) ; HgCommandResult result = commandExecutor . executeInCurrentThread ( repo , "identify" , Arrays . asList ( "--num" , "--id" ) ) ; if ( result == null ) { return Couple . of ( HgRevisionNumber . NULL_REVISION_NUMBER , null ) ; } final List < String > lines = result . getOutputLines ( ) ; if ( lines != null && ! lines . isEmpty ( ) ) { List < String > parts = StringUtil . split ( lines . get ( 0 ) , " " ) ; String changesets = parts . get ( 0 ) ; String revisions = parts . get ( 1 ) ; if ( parts . size ( ) >= 2 ) { if ( changesets . indexOf ( '+' ) != changesets . lastIndexOf ( '+' ) ) { List < String > chsets = StringUtil . split ( changesets , "+" ) ; List < String > revs = StringUtil . split ( revisions , "+" ) ; return Couple . of ( HgRevisionNumber . getInstance ( revs . get ( 0 ) + "+" , chsets . get ( 0 ) + "+" ) , HgRevisionNumber . getInstance ( revs . get ( 1 ) + "+" , chsets . get ( 1 ) + "+" ) ) ; } else { return Couple . of ( HgRevisionNumber . getInstance ( revisions , changesets ) , null ) ; } } } return Couple . of ( HgRevisionNumber . NULL_REVISION_NUMBER , null ) ; }
returns the result of ' hg id ' execution , i . e . current state of the repository .
