Bench switch-to-v4 error

Hi, just trying to update an existing test deployment of V4 and running ‘bench update’ advises that it will cause a major version change from V4 to v5.

As I want to keep the test server on V4 for the moment, when I use ‘bench switch-to-v4’, I get the following error:-
administrator@ubuntu:~/frappe-bench$ bench switch-to-v4
Branch v4.x.x set up to track remote branch v4.x.x from upstream.
Switched to a new branch ‘v4.x.x’
remote: Counting objects: 11863, done.
remote: Compressing objects: 100% (4419/4419), done.
remote: Total 11863 (delta 9793), reused 9382 (delta 7423), pack-reused 0
Receiving objects: 100% (11863/11863), 7.29 MiB | 2.73 MiB/s, done.
Resolving deltas: 100% (9793/9793), completed with 911 local objects.
From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
4944fb3…2887913 develop → upstream/develop

  • [new tag] 4.0.0 → 4.0.0
  • [new tag] 4.0.0-beta1 → 4.0.0-beta1
  • [new tag] v3.1.0 → v3.1.0
  • [new tag] v3.1.1 → v3.1.1
  • [new tag] v3.1.2 → v3.1.2
  • [new tag] v3.2.0 → v3.2.0
  • [new tag] v3.2.1 → v3.2.1
  • [new tag] v3.2.2 → v3.2.2
  • [new tag] v3.2.3 → v3.2.3
  • [new tag] v3.3.0 → v3.3.0
  • [new tag] v3.3.1 → v3.3.1
  • [new tag] v3.3.2 → v3.3.2
  • [new tag] v3.3.3 → v3.3.3
  • [new tag] v3.3.4 → v3.3.4
  • [new tag] v3.3.5 → v3.3.5
  • [new tag] v3.3.6 → v3.3.6
  • [new tag] v3.3.7 → v3.3.7
  • [new tag] v3.3.8 → v3.3.8
  • [new tag] v3.4.0 → v3.4.0
  • [new tag] v3.4.1 → v3.4.1
  • [new tag] v3.4.2 → v3.4.2
  • [new tag] v3.4.3 → v3.4.3
  • [new tag] v3.4.4 → v3.4.4
  • [new tag] v3.4.5 → v3.4.5
  • [new tag] v3.4.6 → v3.4.6
  • [new tag] v3.4.7 → v3.4.7
  • [new tag] v3.4.8 → v3.4.8
  • [new tag] v3.4.9 → v3.4.9
  • [new tag] v3.5.0 → v3.5.0
  • [new tag] v3.5.1 → v3.5.1
  • [new tag] v3.6.0 → v3.6.0
  • [new tag] v3.6.1 → v3.6.1
  • [new tag] v3.6.2 → v3.6.2
  • [new tag] v3.6.3 → v3.6.3
  • [new tag] v3.6.4 → v3.6.4
  • [new tag] v3.6.5 → v3.6.5
  • [new tag] v3.6.6 → v3.6.6
  • [new tag] v3.7.0 → v3.7.0
  • [new tag] v3.7.1 → v3.7.1
  • [new tag] v3.8.0 → v3.8.0
  • [new tag] v3.8.1 → v3.8.1
  • [new tag] v3.8.2 → v3.8.2
  • [new tag] v3.8.3 → v3.8.3
  • [new tag] v3.8.4 → v3.8.4
  • [new tag] v3.8.5 → v3.8.5
  • [new tag] v3.8.6 → v3.8.6
  • [new tag] v4-beta2 → v4-beta2
  • [new tag] v4.0.1 → v4.0.1
  • [new tag] v4.10.0 → v4.10.0
  • [new tag] v4.11.0 → v4.11.0
  • [new tag] v4.11.1 → v4.11.1
  • [new tag] v4.11.2 → v4.11.2
  • [new tag] v4.12.0 → v4.12.0
  • [new tag] v4.13.0 → v4.13.0
  • [new tag] v4.13.1 → v4.13.1
  • [new tag] v4.14.0 → v4.14.0
  • [new tag] v4.15.0 → v4.15.0
  • [new tag] v4.15.1 → v4.15.1
  • [new tag] v4.15.2 → v4.15.2
  • [new tag] v4.15.3 → v4.15.3
  • [new tag] v4.15.4 → v4.15.4
  • [new tag] v4.16.0 → v4.16.0
  • [new tag] v4.17.0 → v4.17.0
  • [new tag] v4.18.0 → v4.18.0
  • [new tag] v4.18.1 → v4.18.1
  • [new tag] v4.19.0 → v4.19.0
  • [new tag] v4.20.0 → v4.20.0
  • [new tag] v4.20.1 → v4.20.1
  • [new tag] v4.20.2 → v4.20.2
  • [new tag] v4.21.0 → v4.21.0
  • [new tag] v4.21.1 → v4.21.1
  • [new tag] v4.21.2 → v4.21.2
  • [new tag] v4.21.3 → v4.21.3
  • [new tag] v4.21.4 → v4.21.4
  • [new tag] v4.22.0 → v4.22.0
  • [new tag] v4.22.1 → v4.22.1
  • [new tag] v4.22.2 → v4.22.2
  • [new tag] v4.23.0 → v4.23.0
  • [new tag] v4.24.0 → v4.24.0
  • [new tag] v4.3.0 → v4.3.0
  • [new tag] v4.4.0 → v4.4.0
  • [new tag] v4.4.1 → v4.4.1
  • [new tag] v4.4.2 → v4.4.2
  • [new tag] v4.5.0 → v4.5.0
  • [new tag] v4.5.1 → v4.5.1
  • [new tag] v4.5.2 → v4.5.2
  • [new tag] v4.6.0 → v4.6.0
  • [new tag] v4.6.1 → v4.6.1
  • [new tag] v4.6.2 → v4.6.2
  • [new tag] v4.7.0 → v4.7.0
  • [new tag] v4.7.1 → v4.7.1
  • [new tag] v4.7.2 → v4.7.2
  • [new tag] v4.8.0 → v4.8.0
  • [new tag] v4.9.0 → v4.9.0
  • [new tag] v4.9.1 → v4.9.1
  • [new tag] v4.9.2 → v4.9.2
  • [new tag] v4.9.3 → v4.9.3
  • [new tag] v4.24.1 → v4.24.1
  • [new tag] v4.24.2 → v4.24.2
  • [new tag] v4.24.3 → v4.24.3
    error: pathspec ‘v4.x.x’ did not match any file(s) known to git.
    Error: None
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
    File “/home/administrator/bench-repo/bench/cli.py”, line 55, in cli
    bench()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 610, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 590, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 416, in invoke
    return callback(*args, **kwargs)
    File “/home/administrator/bench-repo/bench/cli.py”, line 309, in _switch_to_v4
    switch_to_v4()
    File “/home/administrator/bench-repo/bench/app.py”, line 156, in switch_to_v4
    switch_branch(‘v4.x.x’, apps=apps, bench=bench)
    File “/home/administrator/bench-repo/bench/app.py”, line 147, in switch_branch
    exec_cmd(“git checkout {branch}”.format(branch=branch), cwd=app_dir)
    File “/home/administrator/bench-repo/bench/utils.py”, line 72, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
    File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command ‘git checkout v4.x.x’ returned non-zero exit status 1

The system is currently running the following versions:-
ERPNext: v4.24.0
Open Source Enterprise Resource Planning for Small and Midsized OrganizationsFrappe Framework: v4.13.1
Full Stack Web Application Framework in Python

Running ‘bench switch-to-master’ causes a similar error

Thanks, Ardan

Hey Ardan,
Can you run,

cd apps/frappe
git config --add remote.upstream.fetch '+refs/heads/*:refs/remotes/upstream/*
git fetch upstream --unshallow
cd -
cd apps/erpnext
git config --add remote.upstream.fetch '+refs/heads/*:refs/remotes/upstream/*
git fetch upstream --unshallow
cd -

and try the switch-to-v4 command again?
Let me know if it works, will add it to bench :smile:

1 Like

Hi Pratik, ran into a couple of issues:-

The 1st line of git command’s won’t run without a ’ at the end so I added it and it ran OK.
The 2nd line “git fetch upstream --unshallow” returns with an error:-
fatal: --unshallow on a complete repository does not make sense
Thanks, Ardan

Can you try running fetch without --unshallow and then run bench switch-to-v4?

That seems to have done the trick. No errors encountered with the git commands and the ‘bench switch-to-v4’ went through as well without any errors.

The running app now shows-

Installed Apps ERPNext: v4.24.4
Open Source Enterprise Resource Planning for Small and Midsized OrganizationsFrappe Framework: v4.13.6
Full Stack Web Application Framework in Python

Many thanks, Ardan

Awesome! Will automate this in bench
Thanks for testing