Mercurial for each workflow, one developer

I read similar posts by SO, the official Hg guide, many articles and tutorials, and it’s still unclear to me what the best Hg workflow for development by feature. Perhaps some of the articles on the Internet are years old and do not include the latest features from Hg. Obviously, there are also many options for how to approach it.

I am a solo developer working on a project where a request for a fix or function will be presented to me as a task, for example, "Task No. 546 - Change Everything." Some of these tasks take several days, and some tasks are open for several months, and often up to a dozen times at a time. The task is sent to the final site after it is approved by the customer.

The Hg manual seems to recommend having a clone for each function. But having a dozen full copies of the site on my drive seems ... wasteful? I try for it, but I saw other sentences that make more sense. Do people really have a dozen copies of each site on their development machine at the same time?

The name of the branches first sounds as I would like, where I would call the branch "task 546", and then merge it back when it leaves. I see a lot of discussion about the persistence of names and the fact that they have so many branches (although they can be closed). Some people seem to care about this, and some do not. I don't know if Hg is enough to know if I care or not, and what the flaws mean.

Finally, bookmarks seem to be popular in later articles, and it would seem that the best way to use them is to set the bookmark as "task 546" and then merge it back into the main branch by fixing the message with the task number in it to save a link to what was done in the work. I know that you can delete bookmarks, but it is unclear whether I need to do this after the final merge.

So, my idea of ​​a combined approach is to:

one repo

three named branches:

  • "default" which contains the released version of the site
  • "dev" on which I really use development
  • "test", in which all tasks considered by the client will be performed.

in the "dev" branch, I would use bookmarks for each of the tasks I'm working on, so I have a head for each task.

My workflow for a task / function would be as follows:

  • Update to the main line of the "dev" branch with the name
  • Launch a new branch using the tab for the task "task number 123"
  • Commit the changes until I am ready for viewing by the client.
  • Merge task 123 into the test branch
  • Deploy a β€œtest” on a test server
  • Repeat commit, merge, deployment until ready for release
  • When approved, merges with the main line of the "dev" branch with a commit message that includes the task name
  • Merge "dev" into the "default" branch.
  • Expand the "default" branch on the real server
  • Merge "default" into branches of open functions

Thoughts? Can I best have a clone for each function and the live and test repos I click on?

Edit: I see through some links that I should do "default" development, so my first change in my list will be to use the "production" branch instead of the "dev" named branch.

+4
source share
2 answers

Branch bookmark style (Git-like "branches") does not work well in at least two common cases

  • Cross-cutting challenges are integrated into the development process
  • Time-back machine, when you want to see "the whole history of changes for task No. 123" (you can do it visually and, with some grimaces and jumps, using revsets)

Although using the named branches does not have such problems, and, btw, a workflow with named branches (and only the default branch as the aggregation point) will be a less complex and more logical way

  • By default they contain only merges from task branches, the default chapter is always "stable version"
  • The chapters of the named branches are WIP; branches combined with default - completed (and accepted by the client - see below) work
  • By default, combined with the task branch (after developing the task, before merging the task branch with the default) is equivalent to your "test": without affecting the mainline, you can test the final state of the function integrated into your stable application, show the results for the client
  • Accepted work added to stable trunk by merging default named branch
  • The history ( full history ) of changes for each task in the past can be easily restored using a single, easy, short, catchy log trim: -r "branch(TASK-ID)"
+3
source

I like it. +1 So I would do that.

+1
source

Source: https://habr.com/ru/post/1488881/


All Articles