更改 Mercurial 中存储库的根目录
我正在开发一个具有文件夹结构的 Android 游戏:
\bin
\data (contains game graphics)
\libs (libgdx engine jars)
\src
----\com
--------\brand
------------\game
(*.class files)
愚蠢的是,我在 \src 目录中创建了一个 Mercurial 存储库 (hg init)。因此,如果我更新任何图形(小文件大小),它们在我提交时不会添加到存储库中。我的问题是:如何更改存储库的根目录以包含 \data 目录以及 \src 目录,但不包含 \libs 目录,因为它包含 10-20mb jars?
I'm working on an Android game with the folder structure:
\bin
\data (contains game graphics)
\libs (libgdx engine jars)
\src
----\com
--------\brand
------------\game
(*.class files)
Foolishly, I created a mercurial repository (hg init) in the \src directory. Thus, if I update any of the graphics (small file sizes), they aren't added to the repo when I commit. My question is: how can I change the root of the repo to include the \data directory as well as the \src directory, but without including the \libs directory as that includes 10-20mb jars?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有两种方法可以做到这一点。
1)开始一个新的仓库。这既快速又简单,但您会丢失您的历史记录。
2)使用hg重命名。这实际上是一个移动命令。
将 src 目录重命名为有意义的名称,然后执行此操作。
There are two ways to do this.
1) Start a new repo. It's quick and easy but you'll lose your history.
2) Use hg rename. This is effectively a move command.
Rename the src directory to be something meaningful and then do this.
如果您不想只进行
hg 重命名
,则可以使用 convert 扩展(默认情况下 Mercurial 附带此扩展,您只需在您的.hgrc
)。使用
--filemap
参数运行它并一个文件映射文件,其内容如下:您最终将得到一个包含所有历史记录的新存储库,但您的
com
目录已移至src/com
中。然后,您可以将bin
、data
和libs
文件夹复制到其中,运行hg addremove
就可以了很好,可以走了。警告:新的存储库与旧的存储库完全不同——变更集 ID 等会有所不同,因此您过去合作过的任何人都必须使用新的存储库。
If you don't want to just do an
hg rename
, you can do it with the convert extension (which comes by default with Mercurial, you just need to enable it in your.hgrc
).Run it with the
--filemap
parameter and a filemap file that has something like:You will end up with a new repository with all of your history, but with your
com
directory moved intosrc/com
. You can then copy youbin
,data
andlibs
folders in there, runhg addremove
and you should be all good to go.Warning: the new repo is completely different than the old one -- changeset IDs and such will be different, so anybody you worked with in the past will have to get on the new repo.