Skip to content

Commit

Permalink
RF: Replace all AnnexRepo.merge_annex() usage with AnnexRepo.localsync()
Browse files Browse the repository at this point in the history
  • Loading branch information
mih committed Mar 6, 2020
1 parent 254773a commit 1c39a57
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
4 changes: 2 additions & 2 deletions datalad/distribution/publish.py
Expand Up @@ -313,7 +313,7 @@ def _publish_dataset(ds, remote, refspec, paths, annex_copy_options, force=False
# each fetch could give evidence that there is an annex
# somewhere and replace the repo class...
if isinstance(ds.repo, AnnexRepo):
ds.repo.merge_annex(r)
ds.repo.localsync(r)
ds.config.reload()

# anything that follows will not change the repo type anymore, cache
Expand Down Expand Up @@ -438,7 +438,7 @@ def _publish_dataset(ds, remote, refspec, paths, annex_copy_options, force=False
if is_annex_repo:
lgr.debug("Obtain remote annex info from '%s'", remote)
_maybe_fetch(ds.repo, remote)
ds.repo.merge_annex(remote)
ds.repo.localsync(remote)

# Note: git's push.default is 'matching', which doesn't work for first
# time publication (a branch, that doesn't exist on remote yet)
Expand Down
4 changes: 1 addition & 3 deletions datalad/distribution/update.py
Expand Up @@ -394,9 +394,7 @@ def _plain_merge(repo, _, target, merge_opts=None):

def _annex_plain_merge(repo, _, target, merge_opts=None):
yield from _plain_merge(repo, _, target, merge_opts=merge_opts)
# Note: Avoid repo.merge_annex() so we don't needlessly create synced/
# branches.
repo.call_git(["annex", "merge"])
repo.localsync()


def _annex_sync(repo, remote, _target, merge_opts=None):
Expand Down
15 changes: 2 additions & 13 deletions datalad/support/annexrepo.py
Expand Up @@ -1843,19 +1843,8 @@ def enable_remote(self, name, options=None, env=None):
raise e
self.config.reload()

def merge_annex(self, remote=None):
"""Merge git-annex branch
Merely calls `sync` with the appropriate arguments.
Parameters
----------
remote: str, optional
Name of a remote to be "merged".
"""
self.sync(
remotes=remote, push=False, pull=False, commit=False, content=False,
all=False)
def merge_annex(self, remote=None): # do not use anymore, use localsync()
self.localsync(remote)

def sync(self, remotes=None, push=True, pull=True, commit=True,
content=False, all=False, fast=False):
Expand Down
2 changes: 1 addition & 1 deletion datalad/support/tests/test_annexrepo.py
Expand Up @@ -1686,7 +1686,7 @@ def test_get_description(path1, path2):
# add a little probe file to make sure it stays untracked
create_tree(path1, {'probe': 'probe'})
assert_not_in('probe', annex2.get_indexed_files())
annex2.merge_annex('annex1')
annex2.localsync('annex1')
assert_not_in('probe', annex2.get_indexed_files())
# but let's remove the remote
annex2.remove_remote('annex1')
Expand Down

0 comments on commit 1c39a57

Please sign in to comment.