Fossil Forum

Error when manipulating tags
Login

Error when manipulating tags

Error when manipulating tags

(1) By anonymous on 2019-02-05 13:22:00 [source]

I stumbled upon this issue when trying to rename a branch. I was going to set the branch tag value for the initial check-in to the new branch name, cancel the sym- tag for the original name & add a new sym- tag for the new name.

However, when trying to manipulate the tags directly on the repository file via the -R switch, it core dumped with the following message (for any tag commands, not just the one below):

$ ~ fossil tag add --raw --propagate sym-temp0 7e15a98821 -R .repo.fossil

SQLITE_ERROR(1): no such table: vfile in "SELECT 1 FROM vfile WHERE pathname='manifest'"
Database error: no such table: vfile
SELECT 1 FROM vfile WHERE pathname='manifest'
zsh: abort (core dumped)  fossil tag add --raw --propagate sym-temp0 7e15a98821 -R .repo.fossil

$ ~

Doing it from within an open checkout, however, works fine.

Any operations that are global in nature (independent of any specific check-out), I do directly against the repo file. Manipulating tags falls into that category for me. If I'm missing something, let me know. Thanks!

(2) By Florian Balmer (florian.balmer) on 2019-02-05 14:43:21 in reply to 1 [link] [source]

This seems to be the same problem that I've recently tried to fix for the reparent command, which also operates on tags:

Check-in [6e80af7e]

Maybe that a better option to fix either of these problems is to omit updates to the check-out manifest file(s) if there's no open check-out, but still allow the tag and reparent commands to operate without an open repository (i.e. with the -R option), which may be handy sometimes?

(3) By Martin Gagnon (mgagnon) on 2019-02-05 15:39:17 in reply to 2 [link] [source]

While I agree that the tag command should be fixed, I think the amend command is better suited for renaming a branch from terminal. It's easier to use than manipulating raw tags and it seems to works with -R argument.

(4) By anonymous on 2019-02-07 09:29:50 in reply to 3 [link] [source]

The only concern I would have with amend instead of tag is that it's not as obvious. In the documentation, branches are explained as tags, and so I would imagine most people would explore using either the branch or tag commands to rename branches.

The most straightforward approach (IMO) would probably be to add a rename sub-command to the branch command, as well as integrate the approach by florian.balmer to ignore manifest update if not within a checkout for the tag command.

(5) By Florian Balmer (florian.balmer) on 2019-02-07 13:17:11 in reply to 4 [link] [source]

Renaming a branch involves adding two tags:

branch BRANCHNAME
sym-BRANCHNAME

Moreover, the old sym-OLDBRANCHNAME tag is cancelled, while the old branch tag is automatically overwritten by the new one.

This can be observed by running the amend command with the --dry-run option.

(6) By Martin Gagnon (mgagnon) on 2019-02-07 13:32:01 in reply to 4 [link] [source]

I agree that it's not obvious that "amend" is the command to use, but it's definitively the easiest way to do what you want.

Per example, to rename a branch, only this amend call would be necessary:

fossil amend --branch temp0 7e15a98821 -R .repo.fossil

(I assume "temp0" is the new branch-name and "7e15a98821" is the uuid of the first checkin of the branch you want to rename)

The amend command was created to have a CLI equivalent of the "edit" link that is accessed via the checkin detail page on the web interface.

May be the "amend" command could be mentioned on the "tag" and "branch" usage help output ? But in the case of the "tag" help output, it is already very verbose, it's actually doesn't fit on my maximized terminal window.

(7) By Peeyush Singh (psingh) on 2019-02-08 00:26:50 in reply to 6 [link] [source]

(This is me, the original poster, I went ahead and created a login)

That's pretty cool. It does certainly look simpler. When renaming a branch I just changed branch, cancelled the original sym- tag, & added the new propagating sym- tag. I don't know much about the amend command, and so will be looking into it later tonight.

Mentioning amend in the help output for branch and tag would be good enough, I think. It wouldn't even need to be a large entry, just as an entry in a "See Also" footer.