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