Automatic incremental numbering for branch names
For example:
I created a branch with the name "Feature1". Now, I want to create a new branch with the name "Feature". Plastic SCM should remember, that there was already a similar branch name, but with a trailing number.
Now, I want the possibility, that Plastic SCM can automatically append the next increment of the previous number. In that case, it would result in "Feature2".
That feature should be able to be activated/deactivated in the branch creation dialog, if a user want so.
Hopefully solved with Carlos answer
-
Carlos commented
Hi Christian,
I´ve used the next after-mkbranch trigger. You could use something similar to rename branches:
----------------------
@echo on
set "PATH=C:\tmp\codigo\01nerva\bin\server;%PATH%"
set "PATH=C:\tmp\codigo\01nerva\bin\client;%PATH%"
set var= %PLASTIC_BRANCH_NAME%
cm rnbr %var%@default@localhost:8084 BranchRenamed
PAUSE -
Christian,
The after-mk-branch should do it correctly. Can you refresh your branch list after the trigger happens? The problem is that the GUI is probably not refreshing correctly after creating the branch, that's all, but the rename branch should work from the trigger as it does later from CLI.
Please check and let us know.
-
Christian Götz commented
I tried it the other way now:
I used the "after-mkbranch" trigger and used all relevant environment variables to invoke a "cm rnbr" command. But it has no effect. The branch name is the same, as before.
Only, when I invoke this command manually after the whole process, the renaming of the branch takes effect as expected.So, maybe the trigger-feature might be the solution for me. But not, as it behaves right now. :-/
-
Christian Götz commented
OK, I just tested the thing with the triggers. But it seems, it does not work, like I want.
I kept the things very simple at first, to try it out:1. I created a script to read out the "PLASTIC_BRANCH_NAME" variable on the "before-mkbranch" trigger event. -> It worked!
2. I tried to modify the "PLASTIC_BRANCH_NAME" variable and so I did append the number "123", just to test it. I also read the modified variable back. -> It worked as expected!
3. But after the real creation of the branch, the branch name was still the original name and not my new modified name.So I wonder, if it is possible to modify these Environment variables or if they are "read only", so that PlasticSCM ignores any modification of them.
When PlasticSCM intentionally ignores any modification of these variables, then the triggers are not a solution for me. :-/ -
Christian Götz commented
Hmm, the thing with the triggers sound interesting.
I will check out, how they work. Maybe, they are the solution for my problem! :-) -
Hi Christian,
Well, looks like an interesting workflow but... why don't you just create a trigger for it? I mean, sounds definitely like a very specific customization, don't you think so? In my case I always link branches to tasks in our issue tracking, so numbering is key and must be associated to the issue tracker, so no way auto-numbering will work.
Thoughts?