Page MenuHomePhabricator

Inspect branch name in mercurial repositories for Refs
Open, Needs TriagePublic

Description

For people who want to work with feature branches, it's very useful to be able to use the branch name in mercurial repos to give the task number.
I have tried with branch names of "T5" and "Ref T5" and neither are apparently currently inspected to extract references.

Event Timeline

msackman raised the priority of this task from to Needs Triage.
msackman updated the task description. (Show Details)
msackman added a project: Diffusion.
msackman added a subscriber: msackman.

Hi Chad,

In googling this issue, I found the page you've linked to and I've read it. It doesn't quite address my needs for the following reasons:

  1. I could put "Ref T5" in every commit comment on the branch. But I'm using feature branches anyway (and in particular, branch per task), so that's duplicated information, and something liable to forget.
  2. Putting "Ref T5" in the commit comment works without needing to use arc. Thus I would like to be able to put refs in the branch name and for that too to work without using arc.
  3. I'm not sure if this is related, but arc branch only works with git.

bummer, didn't know arc branch was git only.

Looking at arc help branch it shows:

Alias for arc feature.

I use mercurial and bits of arc feature, which have all seemed to work fine. From arc help feature:

Supports: git, hg

However according to the output it also states that it wraps bookmarks and not named branches (I'm a bookmark user).

I'm not familiar with Mercurial, but are these feature branches which are eventually merged into a master branch? If so, I've had a thought about this previously... What if you could just put the Ref T5 message in the merge commit and have that associate all commits from the merge with the task? I'm not sure if this is easy to do technically because a branch could be merged into multiple other branches.

Pretty much all the hg stuff uses bookmarks where the git stuff would use branches. This partly makes more sense with Mercurial (in Mercurial, branches are normally permanent and durable, and Mercurial warns you about this when you create one and asks if you meant to create a bookmark instead -- Mercurial bookmarks are more similar to Git branches than Mercurial branches are), and partly Facebook was heavily involved in shaping the Mercurial flows and they use bookmarks.

I think it's unintuitive that arc branch doesn't list branches, see D4753 for some discussion. The way these workflows work is internally consistent within the logic of "arc", but not very friendly for new users.

Mercurial has branches (either named, anonymous, or anonymous w/ bookmarks) which can be merged into the main branch/trunk/stable. However for feature-type branches I usually recommend rebasing which would result in not having an additional merge commit to add the Ref T5 message.

  1. I could put "Ref T5" in every commit comment on the branch.

@msackman - I don't use Maniphest, but would you need to add that to every commit in the branch or just one of the commits for Differential to pick up on it?

@cspeckmim - interesting idea to essentially tag the branch by just one ref in a commit message. I'll try that. However:

  • it's nice to be able to see refs by doing hg branches. It would be much harder to discover the ref if you have to basically grep the first commit msg on each branch to discover the ref.
  • it's one more thing that's easy to forget to do.

@epriestley - I fully appreciate that the git way (and thus the more popular way these days) is with bookmarks and rebasing. However, for those of us who cut our teeth back with VCS history is immutable, we do like using branches, and like the fact that you merge, don't rebase, and don't worry about having a linear history. Yes, there are pros and cons of both, and I'm sure no one is interested in rehashing all those arguments. It would be nice if phabricator integrated a little better with this way of working, that's all.