gpt4 book ai didi

version-control - Mercurial 问题如何处理不同的头

转载 作者:行者123 更新时间:2023-12-04 07:12:23 25 4
gpt4 key购买 nike

我的存储库不能 merge ,不能拉,不能更新,因为它不能简单地关闭不需要的错误头。看来我的 hg 发生了变化,使 merge 变得复杂。我希望更改(头)是无关紧要的,我只想启用一个头和一个分支。

$ hg merge
branch 'default' has 4 heads
$ hg merge -r e571b17295e9
outstanding uncommitted changes (use 'hg status' to list changes)
$ hg commit -m ''
nothing changed

我忘记了 hg push 或 hg pull 吗?如果什么都没有改变,为什么会说未提交的未提交更改?这是我从 hg head 的最新输出。我如何更多地了解这些变化是什么?
为什么像摆脱一个脑袋这样简单的事情几乎是不可能的?
我不好奇 hg 如何定义变更集、修订、头部、分支等,我只是希望简单的操作变得简单。
$ hg head
ändring: 233:88de4be7943c
märke: tip
användare: niklasro
datum: Mon Sep 05 18:30:37 2011 +0000
kortfattat: addremove

ändring: 176:e571b17295e9
användare: tekniklas
datum: Sat Jan 08 04:45:07 2011 +0000
kortfattat: twitter support added

ändring: 159:f8d974793b12
förälder: 157:ef1d955b9236
användare: tekniklas
datum: Sat Dec 18 17:05:45 2010 +0000
kortfattat: remove

ändring: 89:008a2ac46b4f
användare: tekniklas
datum: Sun Aug 01 07:10:40 2010 +0000
kortfattat: classifiedsmarket/market/market_ad_preview.html

我不完全理解如何使用 mercurial,我想要更多的控制,例如看看当有几个所谓的头时,这些日期发生了什么。我主要是这个存储库的唯一开发人员,但希望能够从多个位置更新它。我之前问过这些变化,但我似乎不知道如何做 hg pull从存储库同步到本地。我可以做一个 hg 克隆并添加更改,但上面列出的更改意味着我忘记同步某些内容,我想让它更容易

abort: unsynced remote changes?

How to see a mercurial difference

How to get rid of older mercurial heads?

现在 hg diff、hg status 和 hg 传入不显示任何更改,我已经设法清理了存储库(位于 googlecode.com 上),甚至通过 web ui googlecode.com 更新了文件,所以我想这样做更容易在存储库和本地之间同步。

感谢您的任何建议

编辑:我可以看到变更集 176:e571b17295e9 并不重要,我只想将它与提示 merge ,没有实际更改但获得 1 个头。

enter image description here

所以我尝试并发现变更集无关紧要,我不在乎这个变化:
$ hg diff -c e571b17295e9
diff -r f50d4c4461e5 -r e571b17295e9 classifiedsmarket/app.yaml
--- a/classifiedsmarket/app.yaml Thu Jan 06 11:36:10 2011 +0000
+++ b/classifiedsmarket/app.yaml Sat Jan 08 04:45:07 2011 +0000
@@ -4,6 +4,10 @@
api_version: 1
default_expiration: "400d 5h"
handlers:
+- url: /twitter
+ script: /twitter_oauth_handler.py
+- url: /oauth.*
+ script: /twitter_oauth_handler.py
- url: /
script: i18n.py
- url: /li

那么为什么我需要对根本不重要的变更集进行如此多的管理呢?

所以现在我尝试另一种方式,但也失败了。伟大的。选择 mercurial,你将无法进行开发,因为你所做的只是试图丢失一些垃圾:
hg update -r 123
hg commit --close-branch -m 'Closing old branch'
hg update -C default

我的尝试:
$ hg update -r e571b17295e9
avbryter: crosses branches (merge branches or use --clean to discard changes)

太好了,没有任何效果,我想要做的事情非常简单。我尝试了更多以真正理解不可能做一些非常简单的事情,以及我们如何浪费时间尝试做最基本的事情以及 Mercurial 如何不能做一些简单的事情:
$ hg head
ändring: 235:68bc6873fafb
märke: tip
användare: niklasro
datum: Tue Sep 06 11:53:32 2011 +0000
kortfattat: added fblist

ändring: 176:e571b17295e9
användare: tekniklas
datum: Sat Jan 08 04:45:07 2011 +0000
kortfattat: twitter support added

ändring: 159:f8d974793b12
förälder: 157:ef1d955b9236
användare: tekniklas
datum: Sat Dec 18 17:05:45 2010 +0000
kortfattat: remove

ändring: 89:008a2ac46b4f
användare: tekniklas
datum: Sun Aug 01 07:10:40 2010 +0000
kortfattat: classifiedsmarket/market/market_ad_preview.html

$ hg merge -r e571b17295e9
avbryter: outstanding uncommitted changes (use 'hg status' to list changes)

所以我尝试了另一种方式来明确 VCS 如何完全阻止我进行开发,而这些愚蠢的修改即使在您尝试做的非常简单时也不起作用:
$ hg update -r e571b17295e9
avbryter: crosses branches (merge branches or use --clean to discard changes)

我结束了为我想要关闭的每个修订创建一个新的本地目录,克隆修订,关闭它,提交并从本地克隆推送,它似乎有效,但我这样做是否正确?似乎我仍然可以“打开”封闭的头部,这很好,但我还没有尝试与其他人的更改同步,也没有尝试通过 googlecode.com 中的 webui 进行更改并与本地拉/merge 克隆。

因此,我通过克隆 3 个修订版将未提交的(?)变更集关闭为 mercurial 并一个一个地关闭它们,而不仅仅是 hg head -r -close 或一些可以处理未提交的变更集的简单的 hg 工具。

现在看起来已经解决了,我可以查看多个头是什么:
o  changeset:   181:bb0545ceff33
| parent: 179:b03d10fc4260
| user: tekniklas
| date: Sun Jan 09 04:39:33 2011 +0000
| summary: twitter support
|
| o changeset: 180:9bbefafbdb16
| | parent: 178:e571b17295e9
| | user: niklasro
| | date: Tue Sep 06 14:09:19 2011 +0000
| | summary: close badbranch, this approach never worked
| |
o | changeset: 179:b03d10fc4260
| | parent: 177:f50d4c4461e5
| | user: tekniklas
| | date: Sun Jan 09 04:32:12 2011 +0000
| | summary: removed aeoid
| |
| o changeset: 178:e571b17295e9
|/ user: tekniklas
| date: Sat Jan 08 04:45:07 2011 +0000
| summary: twitter support added
|
o changeset: 177:f50d4c4461e5
| user: tekniklas
| date: Thu Jan 06 11:36:10 2011 +0000
| summary: i18n reports

...
o  changeset:   163:aa078cbdbbe5
| parent: 161:51ec76c45cf0
| user: tekniklas
| date: Sat Dec 18 19:20:25 2010 +0000
| summary: fb login
|
| o changeset: 162:37951de836dc
| | parent: 160:f8d974793b12
| | user: niklasro
| | date: Tue Sep 06 14:17:18 2011 +0000
| | summary: close badbranch, this approach never worked
| |
o | changeset: 161:51ec76c45cf0
| | parent: 159:652958f895e2
| | user: tekniklas
| | date: Sat Dec 18 19:19:41 2010 +0000
| | summary: fb login
| |
| o changeset: 160:f8d974793b12
| | parent: 158:ef1d955b9236
| | user: tekniklas
| | date: Sat Dec 18 17:05:45 2010 +0000
| | summary: remove
| |
o | changeset: 159:652958f895e2
| | parent: 157:9658adb05792
| | user: tekniklas
| | date: Sat Dec 18 19:19:17 2010 +0000
| | summary: fb login
| |
| o changeset: 158:ef1d955b9236
|/ user: tekniklas
| date: Sat Dec 18 17:05:00 2010 +0000
| summary: removed
|
o changeset: 157:9658adb05792
| user: tekniklas
| date: Fri Dec 17 21:57:36 2010 +0000
| summary: tabs

...
o  changeset:   92:9e48ce2a444e
| parent: 90:a381c59aedc1
| user: ubuntu@ubuntu
| date: Mon Aug 02 04:30:31 2010 +0000
| summary: coordinates
|
| o changeset: 91:84facd40c690
| | parent: 89:008a2ac46b4f
| | user: niklasro
| | date: Tue Sep 06 14:18:58 2011 +0000
| | summary: close badbranch, this approach never worked
| |
o | changeset: 90:a381c59aedc1
| | parent: 88:cfcd7313278d
| | user: ubuntu@ubuntu
| | date: Mon Aug 02 04:30:16 2010 +0000
| | summary: logo
| |
| o changeset: 89:008a2ac46b4f
|/ user: tekniklas
| date: Sun Aug 01 07:10:40 2010 +0000
| summary: classifiedsmarket/market/market_ad_preview.html
|
o changeset: 88:cfcd7313278d
| user: ubuntu@ubuntu
| date: Sun Aug 01 05:58:50 2010 +0000
| summary: previewform

...

最佳答案

你可以跑

hg diff -c R

查看您在变更集 R 中更改的内容。您还可以使用 TortoiseHg 之类的日志查看器查看并查看变更集在变更集图中的显示位置。

基本的工作周期是
# work
hg commit
# work
hg commit
hg push
# aborts: multiple remote heads
hg pull
# hg heads show two heads
hg merge
hg commit
hg push

关于version-control - Mercurial 问题如何处理不同的头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7311684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com