astrocatalogs / astrocats

Astrocats package for constructing astronomical catalogs
https://astrocats.space
MIT License
40 stars 12 forks source link

New feature: git pull #79

Closed lzkelley closed 7 years ago

lzkelley commented 7 years ago

Waiting for @guillochon to test before merging.

The current setup is to run git pull -s recursive -X theirs by default, but both options correspond to boolean arguments to the function. If git pull returns a non-zero exit status, the error is logged and an error is raised. For example, if there are local changes to the files, it will complain that they need to be committed or stashed to avoid overwriting... and an error will be raised. In this case, the user could either run the git-push subcommand to commit and push the changes, or toss the local changes using git-reset-origin. Using --ff-only to only accept fast-forward changes might be something to think about for the future.

lzkelley commented 7 years ago

It looks like the travis errors are when catalog tries to run git-reset, and gets the error:

- - - Repo in: '/home/travis/build/astrocatalogs/astrocats/astrocats/catalog/output/catalog-test-output'
Traceback (most recent call last):
  File "/home/travis/build/astrocatalogs/astrocats/astrocats/__main__.py", line 6, in <module>
    main.main()
  File "astrocats/main.py", line 68, in main
    mod.main.main(args, sub_clargs, log)
  File "astrocats/catalog/main.py", line 21, in main
    args_handler.run_subcommand(args, catalog)
  File "astrocats/catalog/argshandler.py", line 39, in run_subcommand
    gitter.git_reset_all_repos(catalog, hard=True, origin=True, clean=True)
  File "astrocats/catalog/gitter.py", line 217, in git_reset_all_repos
    retval = grepo.reset(*args)
  File "/home/travis/miniconda/lib/python2.7/site-packages/git/cmd.py", line 424, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/home/travis/miniconda/lib/python2.7/site-packages/git/cmd.py", line 873, in _call_process
    return self.execute(call, **_kwargs)
  File "/home/travis/miniconda/lib/python2.7/site-packages/git/cmd.py", line 687, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git reset --hard origin/master
  stderr: 'fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]''

I'm unable to reproduce this on my system... but it sounds like the remote isn't setup properly: perhaps adding git remote update might fix it

lzkelley commented 7 years ago

@guillochon is there a way to just rerun travis on this, and see if it works the second time?

guillochon commented 7 years ago

Just restarted it, but I think it will still break since my small change above still broke.

This branch is actually the live branch on the server right now and it seems to work ok, but I'm not using the reset function.