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

Git update_repo fails when there are only untracked files #395

Closed
jfpedroza opened this issue Aug 16, 2022 · 17 comments
Closed

Git update_repo fails when there are only untracked files #395

jfpedroza opened this issue Aug 16, 2022 · 17 comments
Labels

Comments

@jfpedroza
Copy link
Contributor

Currenly when using vcspull sync, and a repo has untracked files and no other changes, the command fails with something like

File "/home/jhon/.local/lib/python3.10/site-packages/vcspull/cli/sync.py", line 104, in update_repo
  r.update_repo(set_remotes=True)  # Creates repo if not exists and fetches
File "/home/jhon/.local/lib/python3.10/site-packages/libvcs/projects/git.py", line 465, in update_repo
  self.run(["stash", "pop", "--index", "--quiet"])
File "/home/jhon/.local/lib/python3.10/site-packages/libvcs/projects/base.py", line 154, in run
  return run(
File "/home/jhon/.local/lib/python3.10/site-packages/libvcs/cmd/core.py", line 211, in run
  raise exc.CommandError(output=output, returncode=code, cmd=cmd)
libvcs.exc.CommandError: Command failed with code 1: git stash pop --index --quiet)

That is because git status returns output including the untracked files while git stash save doesn't have the -u flag and so no stash is actually created.

To fix the problem, one of these should be performed:

  • Add --untracked-files=no to git status
  • Add --include-untracked to git stash save
  • Check if a stash was actually created before trying to pop
@tony tony added the bug label Aug 16, 2022
@jfpedroza
Copy link
Contributor Author

I would like to fix this. Which of the options would prefer?

@tony
Copy link
Member

tony commented Sep 23, 2022

@jfpedroza Hi

I'm not sure of the consequences at scale. All look appetizing, and look like they'd make the syncing more robust.

I would accept a PR with any of those.

And if you wrote a test, that'd be legendary.

P.S. I am going to be making sweeping improvements to this library over the coming months - as well as vcspull. I apologize for how crusty the internals are. They will improve, markedly.

@jfpedroza
Copy link
Contributor Author

So, I went and cloned everything and set up the projects.

It turns out vcspull points to libvcs 0.14 which looks like a different project than master and vcspull won't run with it.

Should I check the changes against the mypy-annotations branch?

@jfpedroza
Copy link
Contributor Author

I got it running with that branch and adding the vcs key to the config entries.

@tony
Copy link
Member

tony commented Sep 24, 2022

@jfpedroza

You've ran into a temporary issue. That's where I'm doing work at the moment - and could probably break within minutes of you making a change (assuming I'm awake)

I'll give you instructions to where the stable branches are

Sorry about that: Backstory: The metaphorical "big dig" is happening, where a major refactor on both sides are being reconciled

@tony
Copy link
Member

tony commented Sep 24, 2022

libvcs branch: v0.13.x
vcspull branch: master

Is this any better?

Or, I can notify you when mypy-annotations is completed (in which case both master branches will work together)

@tony
Copy link
Member

tony commented Sep 24, 2022

I updated both of these:

  • libvcs: v0.13.x

    If you try this locally, does py.test work?

    My changes: Dev package updates, fixed tests on CI (using git --version at 2.27.3)

  • vcspull: master

    README now points to libvcs v0.13.x

When pointing to a live libvcs from vcspull:

Clone libvcs also, then checkout v0.13.x:

git checkout v0.13.x

In vcspull master (or your branch based off master):

pip install -e ~/path/to/libvcs

@tony
Copy link
Member

tony commented Sep 24, 2022

@jfpedroza Due to the state of limbo you've happened upon this issue - I am also happy to PR it on your behalf.

(for both backport and new version of libtmux)

@jfpedroza
Copy link
Contributor Author

I checked out the v0.13.x branch and got this error. Already deleted the virtual env and created it again.

image

@tony
Copy link
Member

tony commented Sep 25, 2022

@jfpedroza Thank you!

poetry self --version
python -V
py.test --version

What do those look like?

@jfpedroza
Copy link
Contributor Author

poetry self --version
Poetry (version 1.2.1)

python -V
Python 3.10.7

poetry run py.test --version
pytest 7.1.3

@jfpedroza
Copy link
Contributor Author

I just realized. Do the tests require Subversion and Mercurial to be installed? Because I absolutely don't have those.

Although, all tests in master pass.

@tony
Copy link
Member

tony commented Sep 25, 2022

Do the tests require Subversion and Mercurial to be installed?

Those should be skipped automatically if you don't have the binary

I will take a closer look now

@tony
Copy link
Member

tony commented Sep 25, 2022

@jfpedroza If you fetch the latest from v0.13.x (ff9247b), is it any better?

@jfpedroza
Copy link
Contributor Author

Tests pass now :D

@tony
Copy link
Member

tony commented Sep 25, 2022

@jfpedroza Brilliant!

@tony
Copy link
Member

tony commented Sep 25, 2022

FYI I will go to sleep for now and be around in the morning tomorrow 🙏

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

Successfully merging a pull request may close this issue.

2 participants