Skip to content

if merge is run prior to sync-code, sync-code will fail #303

@tien-tong

Description

@tien-tong

Issue reported by @smeisler : if merge is done first, then there are results in output_ria that aren't in analysis directory. Therefore datalad push --to output (last step of sync-code) will fail

Potential fix, to be discussed with @mattcieslak and @tsalo

  1. Make babs automatically pull the results into the analysis dir. But user might not intend to do this if they simply want to save their changed code.

  2. We can print an instruction for the user to do it themselves. If decide to do this, need to also upate Error message when datalad push --to output fails, below is the current error, which is probably not that helpful.

summary:
  publish (error: 1, notneeded: 1)
Hints:
1: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. If you want to integrate the remote changes, use 'git pull' before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.
Traceback (most recent call last):
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/bin/babs", line 8, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/babs/cli.py", line 718, in _main
    options.func(**args)
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/babs/cli.py", line 599, in babs_sync_code_main
    babs_proj.babs_sync_code(commit_message=message)
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/babs/update.py", line 33, in babs_sync_code
    self.analysis_datalad_handle.push(to='output')
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/datalad/distribution/dataset.py", line 502, in apply_func
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/datalad/interface/base.py", line 772, in eval_func
    return return_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/datalad/interface/base.py", line 762, in return_func
    results = list(results)
              ^^^^^^^^^^^^^
  File "/users/PAS2965/smeisler/miniforge3/envs/workshop/lib/python3.11/site-packages/datalad/interface/base.py", line 939, in _execute_command_
    raise IncompleteResultsError(
datalad.support.exceptions.IncompleteResultsError: Command did not complete successfully. 1 failed:
[{'action': 'publish',
  'hints': 'Updates were rejected because the remote contains work that you do '
           'not have locally. This is usually caused by another repository '
           'pushing to the same ref. If you want to integrate the remote '
           "changes, use 'git pull' before pushing again. See the 'Note about "
           "fast-forwards' in 'git push --help' for details.",
  'message': 'refs/heads/master->output:refs/heads/master [rejected] (fetch '
             'first)',
  'operations': ['rejected', 'error'],
  'path': '/users/PAS2965/smeisler/workshop/babs/babs_qsirecon/analysis',
  'refds': '/users/PAS2965/smeisler/workshop/babs/babs_qsirecon/analysis',
  'refspec': 'refs/heads/master:refs/heads/master',
  'status': 'error',
  'target': 'output',
  'type': 'dataset'}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues noting problems and PRs fixing those problems.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions