Mercurial 与 Visual Studio 2010 的白痴清单

发布于 2024-10-07 09:01:59 字数 1744 浏览 0 评论 0原文

所以我是一个源代码控制白痴,所以请用这个清单来幽默我。

我最终决定使用 Mercurial + TortoiseHg + (VS2010 + HgSccPackage) + Kiln下一个项目。

我读了 http://hginit.com/ 并玩了很多,但我知道的不多关于源代码控制,所以我不想在这里犯错误,我当前的项目是我迄今为止最大、最有价值的项目。

所以这是我的清单:

创建

  1. 我在 kiln 在线创建一个新的存储库。
  2. 然后将其克隆到我的电脑上。
  3. 我将整个项目文件夹(该文件夹下包含多个项目的解决方案)复制到存储库中。
  4. 我将此内容添加到 .hgignore 文件中回购根目录。
  5. TortoiseHg 中,我单击“添加
  6. 我偶尔从 VS 提交的
  7. 文件”。当我准备好时,我会去同步->推送
    (所以这一切都很好,对吧?)

我在这里遇到的一个问题是。我在 HgScc 中找不到等效的“添加文件”,我注意到当我从 VS-IDE 添加新文件时,它没有源代码管理图标。 (它没有添加到 Mercurial 中?)

所以我最终通过 IDE 添加文件,但他们没有检查。然后在几次提交(以及其他我不记得的事情)之后,我注意到有一个额外的分支或其他东西: alt text

现在如果我尝试推送,我会得到 "(你忘记合并了吗?使用推送 - f 强制)”。 (是的,我点击了传入,并且没有未来的更改)

无论如何,只是一个游乐场,**我刚刚意识到使用 TortoiseHG -> 每次从 VS 创建文件时添加文件修复了问题? **(或者这里有更好的方法吗?)

分支:

所以我对命名分支有点困惑,但 Kiln 作为他们自己的分支/克隆东西。我在这里阅读说明

  1. 所以,在线,我可以选择在 Kiln 在线创建一个“分支”。
  2. 然后我将在本地将其克隆为一个新的存储库(就像它是一个新的存储库一样)
  3. 我将进行更改、提交、推送。
  4. 然后我将从主存储库中拉取并从分支存储库推送到主存储库。

所以我在这里没有真正看到任何合并选项,我猜 Mercurial 会自行处理合并?所以我没有看到存储库资源管理器中的分支?这是应该如何完成的吗?

最后一个问题,“查看历史记录”和“查看更改日志”选项之间有什么区别以及它们对应的 hg 选项是什么?:

alt text


更新:忘了说我是这个项目中唯一孤独的开发者。 =P

So Im a source control idiot so please humor me with this checklist.

I finally decided to use Mercurial + TortoiseHg + (VS2010 + HgSccPackage) + Kiln for my next project.

I read http://hginit.com/ and I played around quite a bit, but I don't know much about source control so I don't want to make a mistake here, my current project is my biggest and most valuable one yet.

So here is my checklist:

Creation:

  1. I create a new repo in kiln online.
  2. Then clone it on my pc.
  3. I copy my entire project folder (Solution with mutiple projects under that folder) into the repo.
  4. I add this content into a .hgignore file in the repo root.
  5. From TortoiseHg I click add files
  6. I occasionally commit from VS.
  7. When I'm good and ready I go Sync->Push
    (So this is all good right?)

One problem I had here is. I can't find Add Files equivalent in HgScc, I noticed when I added a new files from the VS-IDE, it doesn't have the icon for source control. (Its not added to mercurial?)

So I ended up adding files through the IDE and they didn't have a check. Then after a few commits (and other things I don't remember) I noticed there was an extra branch or something:
alt text

And now If I go try to push I get "(did you forget to merge? use push -f to force)". (And yes I hit incoming and I have NO in coming changes)

Anyway,was just a playground, ** I just realized using TortoiseHG ->Add Files everytime I created files from VS fixes things? **(Or is there a better way here?)

Branching:

So Im a little confused about named branching, but Kiln as their own branch/clone thingy. I read instructions here

  1. So, Online, I have option that create a "Branch" in Kiln online.
  2. Then I will clone this as a new repo locally (as if it were a new repo)
  3. I will make my changes, commit, push.
  4. Then I'll pull from the MAIN repo and push from my branch repo to the MAIN.

So I'm not really seeing any merge option here, Im guessing mercurial handles the merging on its own? So I'm not seeing the branch from the repository explorer? Is this how its supposed to be done?

Last question, what is the difference between the View History and View Change Log options and what hg options do they correspond to?:

alt text


Update: Forgot to mention I'm the only lonely developer on this project. =P

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沉默的熊 2024-10-14 09:01:59

这是您的个人问题,每个部分一个,以及我对每个问题的意见/答案。


7.当我准备好后,我会进行同步 -> 推送(所以这一切都很好,对吗?

正确。

此工作流程中可能不同的一件事是是否有其他人也推送到同一存储库。如果您有这样的情况,那么在某些时候,其他人已将变更集推送到您本地没有的变更集,当您尝试推送您的变更集时,这将在在线存储库中创建一个分支,并由多个“头”可见(您应该这样做)。如果您不明白我的意思,请在 Mercurial 上下文中查找该术语。)通常您不允许这种情况发生,因此

当推送中止时,推送将被中止,相反,您将从在线提取变更集 。将存储库下载到您的本地存储库中,将您的变更集头与您刚刚拉出的头合并,然后重新尝试推送,这通常会成功(除非您不幸并且其他人同时推送了更多内容。)


至于 HgSCC 和添加文件,我在使用 HgSCC 时遇到了问题,所以我转向了 VisualHg - http://visualhg.codeplex.com,特别是因为1.52版本的HgSCC在新文件方面似乎有问题。如果您找不到解决方案,我建议您尝试 VisualHG。


你忘记合并了吗?

你应该将你的更改合并在一起,这样你就只剩下一个头了。在该示例屏幕截图中有 3 个,“向表单 2 添加了按钮”、“最终提交”和“2nd prj (2)”。您应该更新到您认为是“项目的大部分”的那个,选择它,然后右键单击其他头之一并在 TortoiseHg 中选择“合并与...”,并完成合并和提交。每次这样的合并+提交都会删除 1 个头,因此您至少需要 2 次这样的合并才能恢复到 1 个头。


Kiln 和 Fogcreek 对于如何处理树枝的概念与许多其他人不同。他们建议您创建一个完全不同的分支存储库并在其中工作,而不是使用命名分支。命名分支类似于您将屏幕截图中的三个变更集(以“最终提交”结尾的 3 个)命名为用于添加新表单或修复大错误的分支。

因此,Kiln“方式”不是像您在这里所做的那样,拥有 3 个头,而是拥有 3 个克隆,每个克隆仅包含直至其分支头的变更集。基本上,您将拥有 1 个存储库克隆,其中包含“添加第二个表单”之前的所有内容,并继续“第二个项目”,但中间的变更集不会在那里。第二个克隆将最多具有“添加的第二个表单”,然后是一个额外标记为“添加按钮以形成”的标签,第三个克隆将具有“添加的第二个表单”,然后三个以“最终提交”结尾。

当然,最后,当推拉返回主存储库时,无论如何您最终都会得到这些分支,但他们建议您使用像更大分支那样的分支存储库,例如添加大功能、模块等。


< strong>我猜测 Mercurial 会自行处理合并?

只有当原始存储库和分支存储库克隆中都有新的变更集时,您的场景中的合并才会发挥作用。

如果有的话,从分支存储库推送到原始存储库(或以其他方式拉取)将在目标存储库中添加新头。这就是合并可以帮助您避免的情况。

通过这种方式,您的工作流程将如下所示:

  1. 将您拥有的所有更改推送到分支存储库(即,由于您首先需要分支存储库的原因而产生的更改集,大错误修复,新功能,大重写,等等)
  2. 尝试从分支存储库推送到原始存储库,收到消息表明这将在目标存储库中创建头,因此您中止该操作。
  3. 从原始存储库拉入分支存储库。这将创建另一个头。
  4. 从分支存储库拉到本地存储库,并在此处进行合并,处理所有合并冲突,最后提交合并变更
  5. 集从本地存储库推送回分支存储库
  6. 在制作之前完成您可能想要在 Kiln 中执行的任何代码审查官方
  7. 从分支存储库推送到原始存储库(请注意,这与步骤 2 相同,如果其他人(或您)同时在原始存储库中完成了更多工作,请跳回步骤 3 并重复)

之间的区别“查看历史记录”和“查看更改日志”选项

区别在于您查看它的方式不同。查看历史记录始终显示您选择的任何内容的历史记录,无论是文件还是解决方案文件本身,即。只是涉及该文件的变更集。

查看更改日志可查看存储库的变更集日志,无论您选择了什么。

Here's your individual questions, one per section, with my opinion/answer on each.


7. When I'm good and ready I go Sync->Push (So this is all good right?

Correct.

The one thing that might differ in this workflow is if there is anyone else also pushing to the same repository. If you have that, at some point someone else has pushed changesets to the repository that you don't have locally. When you try to push yours that would create a branch in the online repository, made visible by multiple "heads" (you should look up that term in Mercurial context if you don't understand what I mean by that.) Generally you don't allow this to happen, so the push will be aborted.

When it aborts, instead you would pull the changesets from the online repository down into your local one, merge your changeset head with the head you just pulled, and then reattempt the push, which would usually succeed (unless you're unlucky and someone else pushed more in the meantime.)


As for HgSCC and Add files, I've had problems with HgSCC so i switched to VisualHg - http://visualhg.codeplex.com, specifically because there seems to be something wrong with the 1.52 version of HgSCC regarding new files. If you can't find a solution for it, I would suggest you try out VisualHG.


did you forget to merge?

You should merge your changes together, so that you only have one head again. You have 3 in that example screenshot, "added button to form 2", "final commit" and "2nd prj (2)". You should update to the one you consider to be "most of your project", select it, then right-click on one of the other heads and select "Merge with..." in TortoiseHg, and complete the merge and commit. Each such merge+commit would remove 1 head, so you need at least 2 such merges to get back down to 1 head.


Kiln and Fogcreek has a different notion on how to handle branches than many others have. They suggest you create a completely different branch repository and work in that, instead of using named branches. A named branch would be akin to you naming the three changesets in your screenshot (the 3 that end with "final commit") as a branch for adding a new form or fixing a big bug.

So instead of doing what you've done here, having 3 heads, the Kiln "way" would be to have 3 clones, each with only the changesets up to their branch head. Basically you would have 1 repo clone with everything up to "added 2nd form", and continuing with "second proj", but the changesets inbetween would not be there. The second clone would have up to "added 2nd form", and then the one extra labelled "added button to form ", and the third would have "added 2nd form", and then the three ending with "final commit".

Of course, in the end, when pushing and pulling to get back to the main repository, you end up with those branches anyway, but they recommend you use branch repositories like that for bigger branches, like adding big features, modules, etc.


Im guessing mercurial handles the merging on its own?

Merging in your scenario would only come into play if you have new changesets in both the original repository and in your branch repository clone.

If you have that, pushing from branch repository to original repository (or pulling the other way) would add new heads in your target repository. This is what merging would help you avoid.

In this way, your workflow would like follows:

  1. Push all the changes you have to your branch repository (ie. the changesets resulting from the reason you needed the branch repository in the first place, big bugfix, new feature, big rewrite, whatever)
  2. Try to push from branch repository to original repository, getting message that this will create heads in the target repository, so you abort that.
  3. Pull from original repository down into branch repository. This will create another heads.
  4. Pull from branch repository to your local repository, and do the merge here, handling any and all merge conflicts, finally committing your merge changeset
  5. Push from local repository back to branch repository
  6. Finalize any code reviews you might want to do in Kiln before you make it official
  7. Push from branch repository to original repository (note this is the same as step 2, if someone else (or you) have done more work in the original repository in the meantime, jump back to step 3 and repeat)

difference between the View History and View Change Log options

The difference is just what you view it on. View History always shows the history for whatever you have selected, be it a file or the solution file itself, ie. just changesets involving that file.

View Changelog views the changeset log for the repository, regardless of what you have selected.

困倦 2024-10-14 09:01:59

打印此内容,将其层压并粘贴在墙上。我做到了。

http://secretgeek.net/mercurial_flow.asp

Print this, laminate it and stick it on the wall. I did.

http://secretgeek.net/mercurial_flow.asp

方圜几里 2024-10-14 09:01:59

如果您的项目尚未受 Mercurial 控制,那么您应该使用“添加到源代码管理”命令。右键单击解决方案资源管理器中的解决方案或项目文件,然后在上下文菜单中选择命令。如果解决方案/项目位置没有,此命令还将创建一个存储库。

如果您在 Visual Studio 之外将项目添加到 Mercurial,则需要在 IDE 中重新加载项目。否则HgSccPackage不知道该项目受到控制。

如果项目受控制,则从 IDE 将现有文件或新文件添加到该项目将自动将它们添加到 Mercurial。

合并命令在“更改日志”对话框中可用。要进行合并,您需要“更新”到 Rev1,然后选择要合并的修订版 (Rev2),然后使用工具栏命令或上下文菜单命令运行“合并”命令。

如果您认为在 HgSccPackage 中发现了错误,请创建一个问题,并在 HgSccPackage 问题跟踪器 (http: //bitbucket.org/zzsergant/hgsccpackage/issues)。

If your project is not controlled by mercurial yet, then you should use "Add to source control" command. Right-click on solution or project file in solution explorer and select the command in context menu. This command will also create a repository at solution/project location if there isn't one.

If you added the project to mercurial outside of Visual Studio, then you need to reload a project in IDE. Otherwise HgSccPackage don't know that the project is controlled.

If the project is controlled, then adding existing or new files to that project from IDE will automaticaly add them to mercurial.

Merge command is available in "Change log" dialog. To do the merge you need to "Update" to Rev1, then select revision you want to merge with (Rev2), and then run "Merge" command using toolbar command or context menu command.

If you think you found a bug in HgSccPackage, then create an issue with steps to reproduce at HgSccPackage issue tracker (http://bitbucket.org/zzsergant/hgsccpackage/issues).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文