位桶,“汞推"和“汞更新" [英] bitbucket, "hg push" and "hg update"

查看:118
本文介绍了位桶,“汞推"和“汞更新"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我从本地商品回购开始,我认为这是主要"回购(请原谅我的dvcs领主),并打算将bitbucket用作备份和问题跟踪工具,那么我可以进行所有更改在我的本地仓库中,然后执行汞推"操作,将更改发送回bitbucket.

If I start out with a local mercurial repo, which I consider to be the "main" repo (pardon me my dvcs lords), and intend to use bitbucket as a backup and issue tracking facility, I can do all my changes in my local repo and do an "hg push" to send the changes back to bitbucket.

我不需要在本地计算机上运行带有"hg update"的"hg push"命令吗?

Don't I need to follow this "hg push" command run on my local machine with an "hg update"?

推荐答案

为什么要关心BitBucket服务器上工作目录中的内容?只要您推送更改,这些更改就会在存储库中,并在BitBucket页面上可见.

Why do you care what's in the working directory on BitBucket's servers? As long as you push the changes will be in the repository and visible on the BitBucket page.

编辑:好,我将其编辑为有用的答案.

OK, I'm going to edit this to be a useful answer.

假设您在BitBucket上克隆了我的一个存储库,例如django-hoptoad.您将在本地计算机上拥有一个名为django-hoptoad的文件夹,其内容如下所示:

Say you clone down one of my repositories like django-hoptoad on BitBucket. You'll have a folder named django-hoptoad on your local machine and its content will look something like this:

django-hoptoad/
 |
 +-- .hg/
 |
 +-- ... my code and other folders

有关存储库本身的所有数据都存储在.hg/文件夹中.那是Mercurial保留有关哪些文件已更改,哪些变更集以及许多其他内容的数据.

All the data about the repository itself is stored in the .hg/ folder. That's where Mercurial keeps the data about which files were changed in which changesets, and lots of other stuff.

您可以这样想(尽管这过于简单):

You can think of it like this (though it's an oversimplification):

django-hoptoad/
 |
 +-- .hg/
 |    |
 |    +-- data about changeset 1
 |    +-- data about changeset 2
 |
 +-- ... my code and other folders as they appear in changeset 2

当您运行hg pull并且不进行更新时,会将所有新的变更集拉入存储库中:

When you run hg pull and don't update, you pull any new changesets into the repository:

django-hoptoad/
 |
 +-- .hg/
 |    |
 |    +-- data about changeset 1
 |    +-- data about changeset 2
 |    +-- data about changeset 3 (NEW)
 |    +-- data about changeset 4 (NEW)
 |
 +-- ... my code and other folders as they appear in changeset 2

如果不更新,... my code and other folders仍将等同于changeset 2中的内容,但其他变更集仍在存储库中.

If you don't update, the ... my code and other folders will still be equivalent to whatever is in changeset 2, but the other changesets are still in the repository.

当您运行hg update时,Mercurial会将... my code and other folders更新为最新变更集的内容.

When you run hg update Mercurial will update the ... my code and other folders to the contents of the newest changeset.

django-hoptoad/
 |
 +-- .hg/
 |    |
 |    +-- data about changeset 1
 |    +-- data about changeset 2
 |    +-- data about changeset 3
 |    +-- data about changeset 4
 |
 +-- ... my code and other folders as they appear in changeset 4

真的,这意味着... my code and other folders中的内容不必与存储库中的内容匹配.您只需删除它,所有更改集仍将在存储库中:

Really, this means that what happens to be in ... my code and other folders doesn't have to match what's in the repository. You could just delete it and all the changesets would still be in the repository:

django-hoptoad/
 |
 +-- .hg/
      |
      +-- data about changeset 1
      +-- data about changeset 2
      +-- data about changeset 3
      +-- data about changeset 4

如果您现在就提交,它将创建一个新的变更集,该变更集基本上说没有文件".不过,您不必承诺.人们仍然可以向您推拉,因为存储库仍然包含有关变更集的所有数据.

If you committed right now, it would create a new changeset that basically says "no files". You don't have to commit though. People can still push and pull from you because the repository still has all the data about the changesets.

几乎可以肯定,这是BitBucket正在做的事情.您永远不会登录到BitBucket的服务器,编辑代码并在那里提交-您只会推/拉/克隆.这意味着... my code and other folders永远不会被实际使用,因此我想Jesper已将其设置为删除它以节省磁盘空间.

This is almost certainly what BitBucket is doing. You're never going to log in to BitBucket's servers, edit your code and commit there -- you're only ever going to push/pull/clone. That means the ... my code and other folders will never actually be used, so I'd imagine Jesper has it set up to delete it to save the disk space.

由于hg update仅真正影响工作目录,并且从未使用过BitBucket上的工作目录,因此在推送到BitBucket后无需运行hg update.

Since hg update only really affects the working directory, and the working directory on BitBucket is never used, you don't need to run hg update after you push to BitBucket.

这篇关于位桶,“汞推"和“汞更新"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆