Package: git-bzr-ng Version: 0+git20120823-1 Severity: wishlist Tags: patch
Hi! The sync subcommand is performing what «git fetch» does for git repositories, and sync is a bit confusing for something that's not bi-directional, so locally I had renamed sync to fetch. It would be nice to have that in the Debian package. I've preserved sync as an alias for backwards compatibility, though. Attached a patch against upstream repo doing that. Thanks, Guillem
From 22b7b19375cc8a2e31de0cdac72e2d3e6f61e4ee Mon Sep 17 00:00:00 2001 From: Guillem Jover <[email protected]> Date: Sun, 3 Feb 2013 17:55:40 +0100 Subject: [PATCH] git-bzr: Rename sync action to fetch This uses the same name as the normal git operation. --- README.rst | 6 +++--- git-bzr | 21 +++++++++++---------- tests/test_basic.py | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index 2f2ec93..b764240 100644 --- a/README.rst +++ b/README.rst @@ -42,11 +42,11 @@ Example usage $ git bzr push How is trunk doing? - Sync is a slow operation the first time, like push. + Fetch is a slow operation the first time, like push. They both speed up after they've done it once for a given branch. $ git checkout master - $ git bzr sync + $ git bzr fetch $ git diff bzr/master Somebody else has a patch and you want to test it locally. @@ -75,7 +75,7 @@ with: :: - $ git bzr sync --overwrite bzr/nova + $ git bzr fetch --overwrite bzr/nova It won't do anything to any branch except the one mentioned and on that one it effectively does a `bzr pull --overwrite`. diff --git a/git-bzr b/git-bzr index a5a1a99..1e45dc8 100755 --- a/git-bzr +++ b/git-bzr @@ -459,8 +459,8 @@ def cmd_push(args): if not options.overwrite and known_upstream and (not upstream or upstream == known_upstream): upstream = known_upstream - # Sync first - cmd_sync([bzr_ref]) + # Fetch first + cmd_fetch([bzr_ref]) # Check that we are a fast-forward # Using the logic from http://github.com/kfish/git-bzr's implementation @@ -495,9 +495,9 @@ def cmd_push(args): set_cfg('%s.upstream' % bzr_ref, upstream) -def cmd_sync(args): - parser = optparse.OptionParser(usage='git bzr sync <bzr_branch>') - parser.description = ('Sync a bzr tracking branch (bzr/*) with remote') +def cmd_fetch(args): + parser = optparse.OptionParser(usage='git bzr fetch <bzr_branch>') + parser.description = ('Fetch a bzr tracking branch (bzr/*) with remote') parser.add_option('--overwrite', action='store_true', dest='overwrite', help='overwrite tracking branch with remote copy') (options, args) = parser.parse_args(args) @@ -515,7 +515,7 @@ def cmd_sync(args): bzr_ref = get_cfg('%s.bzr' % cl.branch()) if not bzr_ref: - die('Which bzr tracking branch do you want to sync?') + die('Which bzr tracking branch do you want to fetch?') upstream = get_cfg('%s.upstream' % bzr_ref) if not upstream: @@ -536,11 +536,11 @@ def cmd_sync(args): def cmd_pull(args): parser = optparse.OptionParser(usage='git bzr pull <bzr_branch>') - parser.description = ('Sync a bzr tracking branch (bzr/*) with remote') + parser.description = ('Fetch a bzr tracking branch (bzr/*) with remote') parser.add_option('--overwrite', action='store_true', dest='overwrite', help='overwrite tracking branch with remote copy') (options, args) = parser.parse_args(args) - cmd_sync(args) + cmd_fetch(args) cl = Changelist() bzr_ref = get_cfg('%s.bzr' % cl.branch()) #git(['pull', '--rebase', '.', '--', bzr_ref]) @@ -677,8 +677,9 @@ COMMANDS = [ ('clone', 'clone a bzr repo', cmd_clone), ('clear', 'clear bzr data for a branch', cmd_clear), ('push', 'push to a bzr repo', cmd_push), - ('sync', 'sync bzr tracking branch to remote', cmd_sync), - ('pull', 'sync bzr tracking branch to remote and pull from it', cmd_pull), + ('fetch', 'fetch bzr tracking branch to remote', cmd_fetch), + ('sync', 'backwards compatible alias for fetch', cmd_fetch), + ('pull', 'fetch bzr tracking branch to remote and pull from it', cmd_pull), ('import', 'import a bzr branch as a new git branch', cmd_import), ('marks', 'show the marks files for a branch', cmd_marks), ] diff --git a/tests/test_basic.py b/tests/test_basic.py index 7122654..de0f1ac 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -270,7 +270,7 @@ class GitBzrTest(SetupVendorOnly, unittest.TestCase): git('commit', '-m', 'touch4 test') gitbzr('push') - # update the bzr branch and sync the changes + # update the bzr branch and fetch the changes # that bzr repo is not a working tree repo so we need to branch it in bzr # and then push the changes back cd(TESTDIR) @@ -280,7 +280,7 @@ class GitBzrTest(SetupVendorOnly, unittest.TestCase): bzr('commit', '-m', 'touch5') bzr('push', '%s_pushed' % BZRBRANCH) cd('%s_git' % BZRBRANCH) - gitbzr('sync') + gitbzr('fetch') # try to push again from git, should fail because we have not merged the # changes -- 1.8.1.3

