-index b576df8..68f68cd 100755
---- a/slug.py
-+++ b/slug.py
-@@ -96,7 +96,14 @@ def getrefs(*args):
- sys.exit(2)
- return refs
-
--def fetch_package(gitrepo, ref2fetch, options):
-+def fetch_package(gitrepo, refs_heads, options):
-+ ref2fetch = []
-+ for ref in refs_heads:
-+ if gitrepo.check_remote(ref) != refs_heads[ref]:
-+ ref2fetch.append('+{}:{}/{}'.format(ref, REMOTEREFS, ref[len('refs/heads/'):]))
-+ if ref2fetch:
-+ ref2fetch.append('refs/notes/*:refs/notes/*')
-+
- try:
- (stdout, stderr) = gitrepo.fetch(ref2fetch, options.depth)
- if stderr != b'':
-@@ -130,13 +137,7 @@ def fetch_packages(options, return_all=False):
- continue
- else:
- gitrepo = GitRepo(os.path.join(options.packagesdir, pkgdir))
-- ref2fetch = []
-- for ref in refs.heads[pkgdir]:
-- if gitrepo.check_remote(ref) != refs.heads[pkgdir][ref]:
-- ref2fetch.append('+{}:{}/{}'.format(ref, REMOTEREFS, ref[len('refs/heads/'):]))
-- if ref2fetch:
-- ref2fetch.append('refs/notes/*:refs/notes/*')
-- args.append((gitrepo, ref2fetch, options))
-+ args.append((gitrepo, refs.heads[pkgdir], options))
-
- updated_repos = []
- pool = WorkerPool(options.jobs, pool_worker_init)
-
-commit 3aa5fead45cce8c63eef64b98ce5dd215cd7dc24
-Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
-Date: Fri Nov 28 12:15:20 2014 +0100
-
- Initialize updated_repos to empty list.
-
-diff --git a/slug.py b/slug.py
-index 914e894..b576df8 100755
---- a/slug.py
-+++ b/slug.py
-@@ -138,6 +138,7 @@ def fetch_packages(options, return_all=False):
- ref2fetch.append('refs/notes/*:refs/notes/*')
- args.append((gitrepo, ref2fetch, options))
-
-+ updated_repos = []
- pool = WorkerPool(options.jobs, pool_worker_init)
- try:
- updated_repos = pool.starmap(fetch_package, args)
-
-commit 3482f3141eb1ecc9cc44d7b6d5af359960a49e73
-Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
-Date: Fri Nov 28 12:13:27 2014 +0100
-
- Parallelize initpackage operation.
-
-diff --git a/slug.py b/slug.py
-index fa8fd89..914e894 100755
---- a/slug.py
-+++ b/slug.py
-@@ -108,15 +108,25 @@ def fetch_package(gitrepo, ref2fetch, options):
- def fetch_packages(options, return_all=False):
- refs = getrefs(options.branch, options.repopattern)
- print('Read remotes data')
-+ pkgs_new = []
-+ if options.newpkgs:
-+ for pkgdir in sorted(refs.heads):
-+ gitdir = os.path.join(options.packagesdir, pkgdir, '.git')
-+ if not os.path.isdir(gitdir):
-+ pkgs_new.append(pkgdir)
-+
-+ pool = WorkerPool(options.jobs, pool_worker_init)
-+ try:
-+ pool.starmap(initpackage, zip(pkgs_new, [options] * len(pkgs_new)))
-+ except KeyboardInterrupt:
-+ pool.terminate()
-+ else:
-+ pool.close()
-+ pool.join()
-+
- args = []
- for pkgdir in sorted(refs.heads):
-- gitdir = os.path.join(options.packagesdir, pkgdir, '.git')
-- if not os.path.isdir(gitdir):
-- if options.newpkgs:
-- gitrepo = initpackage(pkgdir, options)
-- else:
-- continue
-- elif options.omitexisting:
-+ if options.omitexisting and pkgdir not in pkgs_new:
- continue
- else:
- gitrepo = GitRepo(os.path.join(options.packagesdir, pkgdir))
-
-commit 29ab16f193cf3ebccb0c044b98f2ba9be98c3090
-Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
-Date: Sun Nov 23 00:32:46 2014 +0100
-
- Make updateall off by default.
-
- Turn updateall to off by default so 'git pld pull' will only checkout
- packages that were fetched at this session. If you want old behaviour
- use 'git pld pull --all'.
-
-diff --git a/slug.py b/slug.py
-index d083cf4..fa8fd89 100755
---- a/slug.py
-+++ b/slug.py
-@@ -274,7 +274,7 @@ default_options['fetch'] = {'branch': '[*]', 'prune': False, 'newpkgs': False, '
-
- pull = subparsers.add_parser('pull', help='git-pull in all existing repositories', parents=[common_fetchoptions],
- formatter_class=argparse.RawDescriptionHelpFormatter)
--pull.add_argument('--all', help='update local branches in all repositories', dest='updateall', action='store_true', default=True)
-+pull.add_argument('--all', help='update local branches in all repositories', dest='updateall', action='store_true', default=False)
- pull.add_argument('--noall', help='update local branches only when something has been fetched', dest='updateall', action='store_false', default=True)
- newpkgsopt = pull.add_mutually_exclusive_group()
- newpkgsopt.add_argument('-n', '--newpkgs', help='download packages that do not exist on local side',
-
-commit da9abb0e6d7ef1a1440e7f5ac4ad4dbf5538dc99
-Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
-Date: Sun Nov 23 00:28:22 2014 +0100
-
- Add --newpkgs/--nonewpkgs to pull command.
-
- Allow 'git pld pull --newpkgs' to also fetch and pull new packages. Off
- by default.
-
-diff --git a/slug.py b/slug.py
-index da9c050..d083cf4 100755
---- a/slug.py
-+++ b/slug.py
-@@ -276,8 +276,12 @@ pull = subparsers.add_parser('pull', help='git-pull in all existing repositories
- formatter_class=argparse.RawDescriptionHelpFormatter)
- pull.add_argument('--all', help='update local branches in all repositories', dest='updateall', action='store_true', default=True)
- pull.add_argument('--noall', help='update local branches only when something has been fetched', dest='updateall', action='store_false', default=True)
-+newpkgsopt = pull.add_mutually_exclusive_group()
-+newpkgsopt.add_argument('-n', '--newpkgs', help='download packages that do not exist on local side',
-+ action='store_true')
-+newpkgsopt.add_argument('-nn', '--nonewpkgs', help='do not download new packages', dest='newpkgs', action='store_false')
- pull.set_defaults(func=pull_packages, branch='[*]', prune=False, newpkgs=False, omitexisting=False)
--default_options['pull'] = {'branch': ['*'], 'prune': False, 'newpkgs': False, 'omitexisting': False}
-+default_options['pull'] = {'branch': ['*'], 'prune': False, 'omitexisting': False}
-
- checkout =subparsers.add_parser('checkout', help='checkout repositories', parents=[common_fetchoptions],
- formatter_class=argparse.RawDescriptionHelpFormatter)
-
-commit b1096c634ea9b262bd791863d68e2aed3847078d
-Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
-Date: Sun Nov 23 00:18:38 2014 +0100
-
- Parallelize fetching, checking out, cloning.
-
- Parallelize fetching, checking out, cloning using multiprocessing
- module.
-
- By default use number of parallel processes equal to number of
- system CPUs (use old value, 4, as fallback).
-
- Also replace thread based ThreadFetch() with the same multiprocessing
- mechanism as above for consistency.
-
-diff --git a/slug.py b/slug.py
-index 69bd3b9..da9c050 100755