0

As new versions of Mercurial are released, we want to somehow enforce that developers, designers, and others are using the approved (or later) version of Mercurial. For example, we are currently on version 1.8.3 I'd like someway of automatically preventing/denying users access our repositories using anything before 1.8.3, and allow any verson after. Can I do this in a hook?

We run our server on Windows and IIS. I thought about writing an IIS extension that returned 500 errors for clients not at the right version, but the client doesn't send any version information in its HTTP requests, just "mercurial/proto 1.0", which I assume means version 1.0 of Mercurial's HTTP protocol.

Is what I want possible? Are there any other ways to solve this?

We want to do this because Mercurial is case-sensitive. We are 100% on case-insensitive Windows. This causes us numerous case-folding collisions. We waste hours on them. Although Mercurial has improved its handling of case, it still has situations where case-folding issues can be introduced. As case-handling improvements are made in new versions, we want someway to enforce our users onto those versions so new problems aren't introduced that we have to spend time fixing.

Paul Crowley
  • 1,656
  • 1
  • 14
  • 26
Aaron Jensen
  • 25,861
  • 15
  • 82
  • 91

2 Answers2

2

Do you have strong reasons for wanting to enforce this? Mercurial has internal mechanisms that take care of version features themselves: If you create a repository with 1.8.3 that uses features not yet present in, say, 1.6, then an 1.6 client will refuse to interact with such a repository. In other words, mercurial itself denies access, but not based on version number, but based on actual features. This way, if a new release doesn't break compatibility either way, you can use both versions alongside each other without problems.

Internally, this works because mercurial adds a list of required features to the repository's metainformation, and checks this list before attempting to do anything with it. If the list contains a feature mercurial doesn't know about (yet), it concludes that it cannot meaningfully interact with it and refuses to cooperate.

So IMO the best thing to do would be to simply instate a policy that requires developers to use an up-to-date version, but not add additional technical measures. If someone tries to push with a version that's really too old, then they'll receive an error message, and if they complain, you can simply point them at the official policy.

tdammers
  • 20,353
  • 1
  • 39
  • 56
  • I've updated my question to include our motivation for wanting this feature. – Aaron Jensen Aug 23 '11 at 19:50
  • I see... well, Windows compares case-insensitively, but it does store case. Maybe there's a way you can prevent the case clashes in the first place, outside of mercurial? – tdammers Aug 23 '11 at 20:35
0

If you're on Windows, how about deploying the Mercurial installer using Domain policies somehow?

Macke
  • 24,812
  • 7
  • 82
  • 118