I have a repository that runs Kallithea 0.2.1 with Mercurial support and access via http
So I add new translation component to the Weblate Project with the following parameters:
Version control system - Mercurial
Source code repository - http://username:mypassword@domain:portnumber/repository
Repository branch - testing
But after pressing continue I get an error under the "Source code repository" field - "Could not update repository: abort: unknown revision 'testing'! (255)"
Weblate's log looks as following
2019-09-12 18:38:03,510 DEBUG hg: exec hg init /data_directory/vcs/project/component [retcode=0]
2019-09-12 18:38:03,510 DEBUG hg: exec hg init /data_directory/vcs/project/component [retcode=0]
2019-09-12 18:38:03,522 INFO project/component: updating repository
2019-09-12 18:38:27,016 DEBUG hg: exec hg pull --branch . [retcode=0]
2019-09-12 18:38:27,016 DEBUG hg: exec hg pull --branch . [retcode=0]
2019-09-12 18:38:27,017 INFO project/component: update took 23.49 seconds
2019-09-12 18:38:27,017 DEBUG project/component: update: pulling from http://username:*@domain:portnumber/repository
2019-09-12 18:38:27,018 DEBUG project/component: update: adding changesets
2019-09-12 18:38:27,018 DEBUG project/component: update: adding manifests
2019-09-12 18:38:27,018 DEBUG project/component: update: adding file changes
2019-09-12 18:38:27,018 DEBUG project/component: update: added 1326 changesets with 4606 changes to 1300 files
2019-09-12 18:38:27,019 DEBUG project/component: update: (run 'hg update' to get a working copy)
2019-09-12 18:38:27,106 DEBUG hg: exec hg branches --template {branch}
[retcode=0]
2019-09-12 18:38:27,106 DEBUG hg: exec hg branches --template {branch}
[retcode=0]
2019-09-12 18:38:27,190 DEBUG hg: exec hg update testing [retcode=255]
2019-09-12 18:38:27,190 DEBUG hg: exec hg update testing [retcode=255]
If I then connect to the Weblate server via ssh and go to the /data_directory/vcs/project/component and print out command hg branch it states that the current branch is "default". Moreover the output of command hg branches --template {branch}"\n" doesn't list the branch "testing" in available branches.
"default" is a long depricated branch in this repository, but it seems that for some reason Weblate pulls it instead of the branch "testing" that I required on the "Add new component" screen.
I fixed this by removing all the files and pulling the needed branch to the data directory manually
rm -fr ./* .*
hg pull http://username:mypassword@domain:portnumber/repository
hg update testing
After this on Weblate component creation screen (which I dodn't close) I press the save button again and can continue with file selection. The only anomaly is that at Manage>Repository maintenance it says that "The remote repository needs to be merged!" and after a first commit "There are some new commits in the local repository." although everything seems to work fine and remote repository status is OK.
I was wondering if it's a bug in Weblate, a faulty repository or me doing something wrong?
And another note maybe related to this - merge style of the component was "rebase" by default and I couldn't make Weblate push changes back to repository. After changing it to "merge" everything works fine.
Documentation states that the default method is "merge" so maybe it's a bug that by default my component used "rebase" method.
This is probably caused by 1157140b3a3 (from #1308) which introduced fetching of current branch only and broke branches switching.
I've tried to draft fixes in https://github.com/WeblateOrg/weblate/pull/3025, it would be great if you could test this.
Still no success, although there are some differences now.
The UI now has error "Could not fetch the repository: abort: unknown branch ''testing''! (255)"
The log:
2019-09-16 14:52:08,695 DEBUG hg: exec hg init /data_directory/vcs/project/component [retcode=0]
2019-09-16 14:52:08,695 DEBUG hg: exec hg init /data_directory/vcs/project/component [retcode=0]
2019-09-16 14:52:08,709 INFO project/component: updating repository
2019-09-16 14:52:09,211 DEBUG hg: exec hg pull --branch 'testing' [retcode=255]
2019-09-16 14:52:09,211 DEBUG hg: exec hg pull --branch 'testing' [retcode=255]
2019-09-16 14:52:09,211 ERROR Could not update the repository: RepositoryException: abort: unknown branch ''testing''! (255)
Still when going to the repository and executing hg branch it says default, but the fix with manually pulling and updating to the desired branch works no more.
Sorry, I've messed up an original patch, will push fixed version soon.
The PR should be now in good shape.
Get another error now.
UI - Could not update repository: abort: no rebase in progress (255)
Log:
2019-09-16 18:11:15,138 DEBUG hg: exec hg init /data_directory/vcs/project/component [retcode=0]
2019-09-16 18:11:15,138 DEBUG hg: exec hg init /data_directory/vcs/project/component [retcode=0]
2019-09-16 18:11:15,152 INFO project/component: updating repository
2019-09-16 18:11:44,392 DEBUG hg: exec hg pull --branch testing [retcode=0]
2019-09-16 18:11:44,392 DEBUG hg: exec hg pull --branch testing [retcode=0]
2019-09-16 18:11:44,392 INFO project/component: update took 29.24 seconds
2019-09-16 18:11:44,393 DEBUG project/component: update: pulling from http://username:*@domain:portnumber/repository
2019-09-16 18:11:44,393 DEBUG project/component: update: adding changesets
2019-09-16 18:11:44,393 DEBUG project/component: update: adding manifests
2019-09-16 18:11:44,393 DEBUG project/component: update: adding file changes
2019-09-16 18:11:44,393 DEBUG project/component: update: added 2687 changesets with 10461 changes to 2248 files
2019-09-16 18:11:44,394 DEBUG project/component: update: (run 'hg update' to get a working copy)
2019-09-16 18:11:44,479 DEBUG hg: exec hg branches --template {branch}
[retcode=0]
2019-09-16 18:11:44,479 DEBUG hg: exec hg branches --template {branch}
[retcode=0]
2019-09-16 18:11:44,570 DEBUG hg: exec hg log --limit 1 --template {node} [retcode=0]
2019-09-16 18:11:44,570 DEBUG hg: exec hg log --limit 1 --template {node} [retcode=0]
2019-09-16 18:11:44,690 DEBUG hg: exec hg log --template "{node}
" --rev heads(branch(.)) - . [retcode=0]
2019-09-16 18:11:44,690 DEBUG hg: exec hg log --template "{node}
" --rev heads(branch(.)) - . [retcode=0]
2019-09-16 18:11:45,324 DEBUG hg: exec hg log --template "{node}
" --rev .::remote(.) - . [retcode=0]
2019-09-16 18:11:45,324 DEBUG hg: exec hg log --template "{node}
" --rev .::remote(.) - . [retcode=0]
2019-09-16 18:11:45,852 DEBUG hg: exec hg rebase -d remote(.) [retcode=255]
2019-09-16 18:11:45,852 DEBUG hg: exec hg rebase -d remote(.) [retcode=255]
2019-09-16 18:11:45,933 DEBUG hg: exec hg status [retcode=0]
2019-09-16 18:11:45,933 DEBUG hg: exec hg status [retcode=0]
2019-09-16 18:11:45,934 ERROR Failed rebase: str: abort: empty revision set (255)
2019-09-16 18:11:46,018 DEBUG hg: exec hg rebase --abort [retcode=255]
Yet again executing hg branch in data/vcs/project/component directory returns "default" but the trick with manually pulling and updating works again.
My guess is that it is trying to rebase, but as I said before it can't.
And also thank you for you support, I appreciate it.
I've partly addressed this in 0ba7bc302a, it should clone correct branch in the beginning avoiding need to switch branches later.
Thank you for your report, the issue you have reported has just been fixed.
Thanks a lot, the bug is gone!