Mercurial - How do you export your repo's source to a production site?

只愿长相守 提交于 2019-12-08 04:18:00

问题


I've tried using archive in Tortoise HG by opening my repo change log. This doesn't seem to be anything like SVN's export command, where I can simply export a remote repository to the current directory. I use this to get a clean copy of my source for production (without notes and repository data). How can I do something like this in HG? Or, should I just use clone and deal with the repo related data manually?

BTW, I need to do this all via command line since I'm not going to be using Tortoise HG on my Linux server.

Any help is much appreciated.


回答1:


As other responses have pointed out hg archive can do what you want -- it will do archive files or just a file layout, but if you can run mercurial on the server might I suggest making the server a clone, with a hook that updates whenever new changesets are received? So long as you're not editing on the live server there won't be merge conflicts, so it's a safe action.

On the server:

hg clone ssh://host//path/to/dev/repo

and in the server's .hg/hgrc file add these lines

[hooks]
changegroup = hg update

Then as you update on the dev repo to deploy you just do:

hg push ssh://server/path/to/deployrepo

and then you can push from your repo to your server and it'll automatically update.




回答2:


You want the archive option I think...

Try:

hg help archive

You can export the archive as just files, or as tar/zip/etc.

The key is that with archive you start in the repo and specify the destination, vs. in subversion where you start in the destination and specify the location of the repo.

Mercurial doesn't seem to have many options for operating on remote repositories, other than clone and related commands.




回答3:


If you want an output directory free of all repository data, simply delete the .hg directory after you clone.



来源:https://stackoverflow.com/questions/3038573/mercurial-how-do-you-export-your-repos-source-to-a-production-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!