Вопрос

I have a file (some kind of database) which is updated as developers test their code and pushed to a central mercurial repository.

I would like everyone to reuse this file and therefore whenever there is a pull / update from our central repository the local version should be replaced by the one stored centrally. In other words I would like to do a hg update -C for that file only, and having it done automatically upon a pull.

Is this possible to do with mercurial?

Это было полезно?

Решение

Developers can add a hook that does this, but you can't make them (unless you have control over their machines).

Something like this in a clone's .hg/hgrc file will delete the local file so the update replaces it fresh:

[hooks]
preupdate = rm path/to/databasefile

Keep in mind, of course, that update will put in place the version of the file as it appeared in the changeset to which the user is updating. So if you do hg update --rev 0 you'll get the very first version of that file, not the one in the most recent revision.

As an aside, usually if there's a file that changes a lot and is unumergeable you're better off having it be an untracked/ignored file that's fetched out of band -- for example, have your launch script download the latest version.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top