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

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):  
  
<pre>
$ ~ 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

$ ~
</pre>  
  
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]

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

[Check-in &lbrack;6e80af7e&rbrack;][ci]

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`][help-tag] and [`reparent`][help-reparent] commands to operate without an open repository (i.e. with the `-R` option), which may be handy sometimes?

[ci]: https://www.fossil-scm.org/index.html/info/6e80af7e527cbc2b
[help-reparent]: https://www.fossil-scm.org/index.html/help?cmd=reparent
[help-tag]: https://www.fossil-scm.org/index.html/help?cmd=tag

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

While I agree that the [tag](https://www.fossil-scm.org/index.html/help?cmd=tag) command should be fixed, I think the [amend](https://www.fossil-scm.org/index.html/help?cmd=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]

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](https://www.fossil-scm.org/xfer/help/branch) or [tag](https://www.fossil-scm.org/xfer/help/tag) commands to rename branches.  
  
The most straightforward approach (IMO) would probably be to add a rename sub-command to the [branch](https://www.fossil-scm.org/xfer/help/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]

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`][help-amend] command with the `--dry-run` option.

[help-amend]: https://www.fossil-scm.org/index.html/help?cmd=amend

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

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]

(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.