API returning wrong revision for Tip

Issue #907 new
Seth Gray created an issue

I'm using api to determine the tip revision to decide whether a repository mirror is in synch with the source repository. This has worked well for quite a long time, but in the past few months I've found some repositories reporting the wrong mercurial node for Tip. The tip revision seems to be going stale (i.e. after several weeks I notice that tip is reporting a very old revision). If you use the scm manager repository interface you'll see newer revisions present on the repo. Also cloning these repositories shows tip to be a much newer revision.

Restarting scmmanager process fixes the problem temporaraily.

Comments (2)

  1. Seth Gray reporter

    Any ideas on where to look on this? This issue severely compromises the ability to trust a replicated mirror as I have no way to see that latest change sets have made it.

    Without being able to report on Tip - is there another way to get the latest revision using the api?

    Update: I found that the changesets page from the web ui does report the current correct tip, so a workaround (though somewhat lame...) for now is to grab it out of the log. This obviously subject to breaking at some point as you might have someone copy/paste a log into a log, raw format might change, raw url might break... etc. API fix much preferable...

    In Powershell -

    $tgtusername="username"
    $tgtpassword="password"
    $tgtbase64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $tgtusername,$tgtpassword)))
    $tgtheaders=@{Authorization=("Basic {0}" -f $tgtbase64AuthInfo);Accept="application/JSON"} 
    
    $tgtheaders=@{Authorization=("Basic {0}" -f $tgtbase64AuthInfo);Accept="application/JSON"} 
    $content=(invoke-webrequest "https://scmurl.com/hg/Repositorybeingtested/raw-rev/tip" -UseBasicParsing -Headers $tgtheaders).content
    $regex=[RegEx] "# Node ID (?<node>[a-z0-9]+)"
    $content -match $regex
    $node=$matches["node"]
    
  2. Log in to comment