在Mercurial中创建DEFAULT的书签?(Create bookmark off of DEFAULT in Mercurial?)

编程入门 行业动态 更新时间:2024-10-27 16:36:41
在Mercurial中创建DEFAULT的书签?(Create bookmark off of DEFAULT in Mercurial?)

我们使用Mercurial并且不允许创建命名分支,只允许创建单独开发的书签。 我们的上游仓库中只能存在DEFAULT分支。

我对书签的理解主要来自这个页面 ,所以我可能会遗漏一些东西。

我试图找出如何直接在DEFAULT提示下创建书签。 为了使书签提示(例如,MYREV)与DEFAULT提示不同,似乎我必须返回一个版本并从那里创建书签。

有没有办法直接从DEFAULT提示修订版创建书签并让它成为一个单独的提示?

We use Mercurial and are not allowed to create named branches, only bookmarks for separate development. Only the DEFAULT branch must exist in our upstream repo.

My understanding of bookmarks comes primarily from this page, so I may be missing something.

I'm trying to figure out how to create a bookmark directly off the DEFAULT tip. In order to get the bookmark tip (say, MYREV) to be different than the DEFAULT tip, it seems like I must go one revision back and create the bookmark from there.

Is there a way to create a bookmark directly off of the DEFAULT tip revision and have it be a separate tip?

最满意答案

只需在提示上创建书签; 创建书签使其成为活动书签,并且它会自动更新以跟随新提交:

$ hg book new_bookmark_name $ hg commit -m 'change message'

活动书签将简单地移动到新提交; 任何其他书签都留在原地。 在给定时间只有一个书签处于活动状态。

您可以通过更新工作副本来激活现有书签:

$ hg up bookmark_name # make bookmark_name active

Mercurial中的书签就像物理世界书籍中的书签一样; 轻松移动到另一页。 如果您的本地书签未处于活动状态,但您进行了新的提交,请手动将书签指向新的提交:

$ hg book --force -r . bookmark_name

上面的命令强制bookmark_name指向工作目录父修订。

你没有书签; 地方修订自然形成一个分支; 书签只是让你更容易跟踪这些提交。 书签也只是简单的指针; 指向特定修订的名称。 您可以随时更新它们以指向另一个修订版。

Just create your bookmark on the tip; creating a bookmark makes it the active bookmark, and it'll automatically be updated to follow new commits:

$ hg book new_bookmark_name $ hg commit -m 'change message'

An active bookmark will simply be moved over to the new commit; any other bookmarks are left in place. Only one bookmark is active at a given time.

You can always make an existing bookmark active by updating your working copy to it:

$ hg up bookmark_name # make bookmark_name active

Bookmarks in Mercurial are just like bookmarks in books in the physical world; easily moved to another page. If your local bookmark wasn't active but you made a new commit, manually point the bookmark to your new commit:

$ hg book --force -r . bookmark_name

The above command forces bookmark_name to point to the working directory parent revision.

You don't have to have a bookmark; local revisions naturally form a branch; bookmarks just make it easier to keep track of such commits. Bookmarks are also just simple pointers; a name pointing to a specific revision. You can always update them to point to another revision.

更多推荐

本文发布于:2023-08-03 10:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1386715.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:书签   DEFAULT   Mercurial   Create   bookmark

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!