Uploaded image for project: 'Skara'
  1. Skara
  2. SKARA-1101

git webrev for mercurial should ignore config defaults for mercurial commands

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: cli
    • Labels:
      None

      Description

      Webrev on a mercurial repo fails with:

      % git webrev -N -r -2 -C -m
      error: could not resolve reference '-2'

      It also fails with an explicit hash of a rev known to be present, both the full hash and the short hash.

      The problem maybe an incorrect expectation that --rev=x returns exactly 1 revision.

      The patch below to set a --limit=1 seems to work.

      git diff
      diff --git a/vcs/src/main/java/org/openjdk/skara/vcs/hg/HgRepository.java b/vcs/src/main/java/org/openjdk/skara/vcs/hg/HgRepository.java
      index 51f40a2b..552d3de9 100644
      --- a/vcs/src/main/java/org/openjdk/skara/vcs/hg/HgRepository.java
      +++ b/vcs/src/main/java/org/openjdk/skara/vcs/hg/HgRepository.java
      @@ -195,7 +195,7 @@ public class HgRepository implements Repository {

           @Override
           public Optional<Hash> resolve(String ref) throws IOException {
      - try (var p = capture("hg", "log", "--rev=" + ref, "--template={node}\n")) {
      + try (var p = capture("hg", "log", "--rev=" + ref, "--limit=1", "--template={node}\n")) {
                   var res = p.await();
                   if (res.status() == 0 && res.stdout().size() == 1) {
                       return Optional.of(new Hash(res.stdout().get(0)));

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              erikj Erik Joelsson
              Reporter:
              rriggs Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: