Is it allowed to restart the tag in Mercurial?

To update the version number in our software, the script does the following:

$ hg update v3.3
(sed+awk magic to edit version numbers in code base)
$ hg commit -m"Create v3.3.50"
$ hg tag v3.3.50
$ hg push    
abort: push creates new remote head 101b0ff402c6 on branch 'v3.3'!
(pull and merge or see "hg help push" for details about pushing new heads)
$ hg pull --branch v3.3 --rebase
...
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
$ hg push
...
added 2 changesets with 4 changes to 4 files

But after committing, the tag does not appear to exist in the target repository:

$ hg tags | grep v3.3.50
$

Confusingly, the tag is in the .hgtags file:

$ grep v3.3.50 .hgtags 
e7d6c19f8dd86cdad4cb41f543d09dbe5d30405e v3.3.50

And is in the history of changes:

$ hg log -b v3.3
changeset:   7067:701358ca0f4b
branch:      v3.3
user:        Joe User <juser@example.com>
date:        Wed Nov 11 12:41:15 2015 -0800
summary:     Added tag v3.3.50 for changeset e7d6c19f8dd8

changeset:   7066:19aafdd33263
branch:      v3.3
user:        Joe User <juser@example.com>
date:        Wed Nov 11 12:41:15 2015 -0800
summary:     Create v3.3.50

The sequence hg commit / tag / pushworks as expected, but adding rebase seems, at least in part, to remove the tag. Are tags needed for a special command regarding the rebase command?

The mercury version is 2.9.2, and the latest version of Ubuntu is running on the system.

+4
source share
3 answers

This is either oversight or intentional design, and it’s hard to say what it is (more on this below).

, :

hg tag -f -r REVID TAGNAME

, - . .

, ,

hg tag -f -e -r REVID TAGNAME

, , .

, :

hg tag --hidden -f -r 'successors(TAGNAME)' TAGNAME

successors(...) revset , TAGNAME.

hg histedit ( ), ( ) commit, , ( .hgtags ).

, :

hg update --hidden -r 'successors(TAGNAME)'
edit .hgtags                                 # update tag information
hg commit --amend                            # update commit message
hg evolve -a                                 # propagate changes

histedit:

hg histedit -r REVID                         # REVID = tag commit
# In the histedit editor, change "pick" to "edit" for the tag commit,
# then write the file and leave the editor.
edit .hgtags                                 # update tag information
hg commit                                    # provide new commit message
hg histedit --continue                       # rebuild rest of history 

, hg tag , .hgtags . Mercurial .hgtags - . , , , .

, , ( ), .


, ? , (hg rebase --keep ), , . hg graft. , .

+4

.hgtags - . , .

, "Create v3.3.50" changeet "19aafdd33263" - e7d6c19f8dd8 ​​ .

, , , .

+2

, .. , unpushed changeset, -, , , - , rebase, :

those. our assembly script we are now pull, we test, we increase the version commit, pull --rebaseif required, and remember the hash, then on that hash, , again, if necessary (now nothing can be damaged more), and finally, a change is made for. hgtags. pushtagcommitpull --rebasepush

I opened a function request for Mercurial to solve this problem better: https://bz.mercurial-scm.org/show_bug.cgi?id=5352

0
source

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


All Articles