Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash and unclear error message when pushing without a commit #819

Open
mhlakhani opened this issue Jan 20, 2024 · 0 comments
Open

Crash and unclear error message when pushing without a commit #819

mhlakhani opened this issue Jan 20, 2024 · 0 comments

Comments

@mhlakhani
Copy link
Contributor

mhlakhani commented Jan 20, 2024

I hit this crash / error message today, after running (effectively) the following:

sl init --git myrepo
cd myrepo
# create a bunch of files
sl add .
# I forgot to commit...
sl path --add remote/default ssh://git@github.com/mhlakhani/myrepo.git
sl push --to remote/default

This resulted in:

To ssh://github.com/mhlakhani/myrepo.git
 - [deleted]         default
** Sapling SCM (version 0.2.20231113-145254+995db0d6) has crashed:
Traceback (most recent call last):
  File "static:sapling", line 86, in run
    dispatch.run(args, fin, fout, ferr, config)
  File "static:sapling.dispatch", line 160, in run
    status = (dispatch(req) or 0) & 255
              ^^^^^^^^^^^^^
  File "static:sapling.dispatch", line 377, in dispatch
    ret = _runcatch(req)
          ^^^^^^^^^^^^^^
  File "static:sapling.dispatch", line 561, in _runcatch
    return _callcatch(ui, req, _runcatchfunc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.dispatch", line 570, in _callcatch
    return scmutil.callcatch(ui, req, func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.scmutil", line 153, in callcatch
    return func()
           ^^^^^^
  File "static:sapling.dispatch", line 548, in _runcatchfunc
    return _dispatch(req)
           ^^^^^^^^^^^^^^
  File "static:sapling.dispatch", line 1078, in _dispatch
    ret = runcommand(
          ^^^^^^^^^^^
  File "static:sapling.ext.undo", line 176, in _runcommandwrapper
    result = orig(lui, repo, cmd, fullargs, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.ext.undo", line 120, in origunsetpid
    return _orig(*args, **opts)
           ^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.ext.journal", line 80, in runcommand
    return orig(lui, repo, cmd, fullargs, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.ext.sparse", line 444, in _tracktelemetry
    res = runcommand(lui, repo, *args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.ext.copytrace", line 191, in _runcommand
    return orig(lui, repo, cmd, fullargs, ui, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.dispatch", line 765, in runcommand
    ret = _runcommand(ui, options, cmd, d)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.dispatch", line 1119, in _runcommand
    return cmdfunc()
           ^^^^^^^^^
  File "static:sapling.dispatch", line 1077, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.util", line 1396, in check
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.util", line 1396, in check
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.ext.remotenames", line 876, in expushcmd
    return git.push(repo, dest, pushnode, to, force=force)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.git", line 615, in push
    with repo.lock(), repo.transaction("push"):
  File "static:sapling.util", line 772, in __exit__
    self.close()
  File "static:sapling.transaction", line 71, in _active
    return func(self, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "static:sapling.transaction", line 579, in close
    self.after()
  File "static:sapling.localrepo", line 3309, in a
    repo.changelog.inner.updatereferences(repo.metalog())
error.UncategorizedNativeError: target OID for the reference doesn't exist on the repository; class=Reference (4)
Exception ignored in: <function transaction.__del__ at 0x1092aa8e0>
Traceback (most recent call last):
  File "static:sapling.transaction", line 253, in __del__
  File "static:sapling.transaction", line 696, in _abort
  File "static:sapling.vfs", line 314, in unlink
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mhl/projects/myrepo/.sl/store/journal'

The solution was pretty simple: sl commit -m "something"

Could we detect this (admittedly uncommon...) case and avoid a crash/improve the error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant