[projects/git-slug: 134/170] Move depth to common fetch options

glen glen at pld-linux.org
Mon Sep 21 21:50:04 CEST 2015


commit 91d34cfd25f2b498518566b043bc157bceebb3de
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Thu Jul 5 14:28:59 2012 +0100

    Move depth to common fetch options
    
    There is no reason to prevent clone and fetch subcommands to use --depth
    option.

 slug.py     | 6 +++---
 slug.py.txt | 9 +++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/slug.py b/slug.py
index 20ac5ea..6c5d113 100755
--- a/slug.py
+++ b/slug.py
@@ -155,6 +155,7 @@ common_options.add_argument('-d', '--packagesdir', help='local directory with gi
 common_fetchoptions = argparse.ArgumentParser(add_help=False, parents=[common_options])
 common_fetchoptions.add_argument('-j', '--jobs', help='number of threads to use', default=4, type=int)
 common_fetchoptions.add_argument('repopattern', nargs='*', default = ['*'])
+common_fetchoptions.add_argument('--depth', help='depth of fetch', default=0)
 
 parser = argparse.ArgumentParser(description='PLD tool for interaction with git repos',
         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
@@ -163,7 +164,6 @@ subparsers = parser.add_subparsers(help='[-h] [options]')
 update = subparsers.add_parser('update', help='fetch repositories', parents=[common_fetchoptions],
         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
 update.add_argument('-b', '--branch', help='branch to fetch', action=DelAppend, default=['master'])
-update.add_argument('--depth', help='depth of fetch', default=0)
 newpkgsopt = update.add_mutually_exclusive_group()
 newpkgsopt.add_argument('-n', '--newpkgs', help='download packages that do not exist on local side',
         action='store_true')
@@ -179,11 +179,11 @@ init.set_defaults(func=create_packages)
 
 clone = subparsers.add_parser('clone', help='clone repositories', parents=[common_fetchoptions],
         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-clone.set_defaults(func=clone_packages, branch='[*]', prune=False, depth=0, newpkgs=True, omitexisting=True)
+clone.set_defaults(func=clone_packages, branch='[*]', prune=False, newpkgs=True, omitexisting=True)
 
 fetch = subparsers.add_parser('fetch', help='fetch repositories', parents=[common_fetchoptions],
         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-fetch.set_defaults(func=fetch_packages, branch='[*]', prune=False, depth=0, newpkgs=False, omitexisting=False)
+fetch.set_defaults(func=fetch_packages, branch='[*]', prune=False, newpkgs=False, omitexisting=False)
 
 listpkgs = subparsers.add_parser('list', help='list repositories',
         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
diff --git a/slug.py.txt b/slug.py.txt
index 73c63c3..b87854a 100644
--- a/slug.py.txt
+++ b/slug.py.txt
@@ -9,8 +9,8 @@ slug.py - tool to interact with PLD git repositories
 SYNOPSIS
 --------
 [verse]
-'slug.py clone' [-d dir] [-j <threads>] [-r repository] pattern...
-'slug.py fetch' [-d dir] [-j <threads>] [-r repository] pattern...
+'slug.py clone' [-d dir] [--depth depth]  [-j <threads>] [-r repository] pattern...
+'slug.py fetch' [-d dir] [--depth depth]  [-j <threads>] [-r repository] pattern...
 'slug.py init' [-d dir] [-j <threads>] package...
 'slug.py list' [-b pattern...] [-r repository] pattern...
 'slug.py update' [-d dir] [--depth depth] [-j <threads>] [-n|-nn] [-P]
@@ -31,6 +31,9 @@ OPTIONS
     The local repositories are assumed to reside in $HOME/PLD_clone directory. Use this
     options if you want to use a different location.
 
+--depth <depth>::
+    Fetch at most the specified number of commits for every updated branch.
+
 -j <threads>::
     Set the number of threads which are used for fetching operations.
 
@@ -64,8 +67,6 @@ Update the remote branches in the set of packages that match at least one of pat
             Only the remote branches which names match the pattern are updated. If omitted 
 \'master'
             is assumed.
-       --depth <depth>;;
-            Fetch at most the specified number of commits for every updated branch.
         -n;;
         --newpkgs;;
             If the local repository does not exist it is initialized and the specified branches are fetched.
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list