denshoproject / ddr-cmdln

Command-line tools for automating the Densho Digital Repository's various processes.
Other
0 stars 2 forks source link

ddr-sync fails with GitCommandError #63

Closed gjost closed 6 years ago

gjost commented 6 years ago

ddr-sync fails with GitCommandError but git annex sync works. This is with Git version 2.1.4 and git-annex version: 5.20141125+deb8u1.

$ ddr sync -u gjost -m gjost@densho.org -c /var/www/media/ddr/ddr-testing-40031/
Traceback (most recent call last):
  File "/opt/ddr-local/venv/ddrlocal/bin/ddr", line 4, in <module>
    __import__('pkg_resources').run_script('ddr-cmdln==0.9.4b0', 'ddr')
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 765, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1545, in run_script
    exec(code, namespace, namespace)
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/EGG-INFO/scripts/ddr", line 432, in <module>
    main()
  File "/opt/ddr-local/venv/ddrlocal/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/EGG-INFO/scripts/ddr", line 389, in main
    exit,msg = sync(args.user, args.mail, cidentifier.object())
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/commands.py", line 51, in wrapper
    return f(*args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/commands.py", line 33, in wrapper
    return f(*args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/ddr_cmdln-0.9.4b0-py2.7.egg/DDR/commands.py", line 440, in sync
    repo.git.checkout('git-annex')
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/git/cmd.py", line 227, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/git/cmd.py", line 456, in _call_process
    return self.execute(call, **_kwargs)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/git/cmd.py", line 377, in execute
    raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git checkout git-annex' returned exit status 1: error: Your local changes to the following files would be overwritten by checkout:
        changelog
        collection.json
        control
        ead.xml
Please, commit your changes or stash them before you can switch branches.
Aborting
$ git annex sync
commit  ok
pull origin 
ok
push origin 
Counting objects: 1, done.
Writing objects: 100% (1/1), 187 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To git@mits.densho.org:ddr-testing-40031.git
   7859946..4ab6221  master -> synced/master
ok
gjost commented 6 years ago

Maybe there's a problem with GitPython? repo.git.checkout('git-annex') complains that "local changes would be overwritten by checkout" but repo.git.status() doesn't show any local changes. Note: GitPython is currently pegged to 0.3.2.RC1.

>>> from DDR import dvcs
>>> repo = dvcs.repository(c.path, 'gjost', 'gjost@densho.org')
>>> repo.git.fetch('origin')
''
>>> repo.git.checkout('master')
"Your branch is up-to-date with 'origin/master'."
>>> repo.git.pull('origin', 'master')
'Already up-to-date.'
>>> repo.git.checkout('git-annex')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    repo.git.checkout('git-annex')
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/git/cmd.py", line 227, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/git/cmd.py", line 456, in _call_process
    return self.execute(call, **_kwargs)
  File "/opt/ddr-local/venv/ddrlocal/local/lib/python2.7/site-packages/git/cmd.py", line 377, in execute
    raise GitCommandError(command, status, stderr_value)
GitCommandError: 'git checkout git-annex' returned exit status 1: error: Your local changes to the following files would be overwritten by checkout:
        changelog
        collection.json
        ead.xml
        files/ddr-testing-141-1/changelog
        files/ddr-testing-141-1/entity.json
        files/ddr-testing-141-1/files/ddr-testing-141-1-master-c774ed4657.json
        files/ddr-testing-141-1/mets.xml
Please, commit your changes or stash them before you can switch branches.
Aborting
>>> repo.git.status()
"On branch master\nYour branch is up-to-date with 'origin/master'.\nnothing to commit, working directory clean"
>>> repo.git.diff()
''
gjost commented 6 years ago

This is a resurfacing of an old issue from 2015. See email thread "mits sync issues" on 2015-03-30. See also issue "DDR sync not pushing commits to mits remote correctly" (https://github.com/densho/ddr-cmdln/issues/16)

gjost commented 6 years ago

Replaced the manual pull/commit sequence with git annex sync. Looks like it works with git annex version 6.20170101.1 on Debian 9: HEAD, synced/master, master all point to the same commit on the Gitolite server after syncing.

gjost commented 6 years ago

Looks like it's working with git annex version 5.20141125+deb8u1 on Debian 8 too.

gjost commented 6 years ago

Note that we were running git-annex 3.20120629~bpo60+2 back in 2015.

gjost commented 6 years ago

Merged in to develop.

pkikawa commented 6 years ago

syncing from back end (and front end) running fine