D3557: commit: add new close-branch command
indygreg added a comment. I'm -0.25 on this. But I don't think we should add an argument to `hg heads` or `hg branch` because I don't like a) overloading commands to have multiple meanings b) making commands read-write and read-only. I think commands should do one thing and do them well. There should also be a set of //safe// commands that can be executed without meaningful side-effects. Following that logic, a dedicated command is justified. But I just don't feel like closing heads that aren't checked out is a frequent enough operation to justify a dedicated command. As a potential compromise, how about `hg commit --close-branch-rev ` that does the branch closing without needing a working directory? But this seemingly violates the expectation of `hg commit`, which is that it operates on the working directory. Gah - now I think I talked myself into a dedicated command. Good UI design is hard. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: indygreg, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
joerg.sonnenberger added a comment. If we want to go with a `--close` flag, I think the most natural place would actually be `hg heads`. This is not really a branch operation after all, but about cutting off heads. At the same time, none of those options would allow specifying a commit message naturally. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
pulkit added a comment. In https://phab.mercurial-scm.org/D3557#57279, @joerg.sonnenberger wrote: > It doesn't seem to fit the argument schema for `hg branch` at all. I'm open for better places, but I couldn't think of a consistent place. The branch command has a `--rev` flag which we can use. Something like `hg branch --rev --close`. What do you think? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
pulkit added a comment. The code looks mostly good to me. Needs tests for following cases: - when working directory is dirty - when we are in an uncommitted merge state - there is some bookmark movement code, tests for that INLINE COMMENTS > commands.py:1508 > +if not message: > +raise error.Abort(_("No commit message specified with -l or -m")) > +extra = { 'close': '1' } we use all lowercase error messages, so this should be "no commit ..". REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
joerg.sonnenberger added a comment. It doesn't seem to fit the argument schema for `hg branch` at all. I'm open for better places, but I couldn't think of a consistent place. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
pulkit added a comment. > `hg close-branch` allows closing arbitrary heads. It is equivalent to > checking out the given revisions and commit an empty change with > `hg commit --close-branch`. I am -1 on having a new command for this. How about adding this as a `--close` flag to `hg branch` command? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
joerg.sonnenberger created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY ``hg close-branch`` allows closing arbitrary heads. It is equivalent to checking out the given revisions and commit an empty change with ``hg commit --close-branch``. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 AFFECTED FILES mercurial/commands.py tests/test-close-branch.t tests/test-completion.t tests/test-globalopts.t tests/test-help.t tests/test-hgweb-json.t CHANGE DETAILS diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -1800,6 +1800,10 @@ "topic": "cat" }, { +"summary": "close the given head revisions", +"topic": "close-branch" + }, + { "summary": "show combined config settings from all hgrc files", "topic": "config" }, diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -65,6 +65,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -144,6 +145,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -840,6 +842,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -2356,6 +2359,13 @@ output the current or given revision of files + + close-branch + + + close the given head revisions + + config diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -308,6 +308,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -391,6 +392,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -12,6 +12,7 @@ bundle cat clone + close-branch commit config copy @@ -252,6 +253,7 @@ branches: active, closed, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template + close-branch: message, logfile, date, user config: untrusted, edit, local, global, template copy: after, force, include, exclude, dry-run debugancestor: diff --git a/tests/test-close-branch.t b/tests/test-close-branch.t new file mode 100644 --- /dev/null +++ b/tests/test-close-branch.t @@ -0,0 +1,41 @@ + $ hg init + $ hg debugbuilddag '+2*2*3*4' + $ hg log -G --template '{rev}:{node|short}' + o 4:e7bd5218ca15 + | + | o 3:6100d3090acf + |/ + | o 2:fa942426a6fd + |/ + | o 1:66f7d451a68b + |/ + o 0:1ea73414a91b + + $ hg close-branch -m 'Close old heads' 1 2 + $ hg heads + changeset: 4:e7bd5218ca15 + parent: 0:1ea73414a91b + user:debugbuilddag + date:Thu Jan 01 00:00:04 1970 + + summary: r4 + + changeset: 3:6100d3090acf + parent: 0:1ea73414a91b + user:debugbuilddag + date:Thu Jan 01 00:00:03 1970 + + summary: r3 + + $ hg close-branch -m 'Close more old heads' 4 + $ hg heads + changeset: 3:6100d3090acf + parent: 0:1ea73414a91b + user:debugbuilddag +