[projects/git-slug: 50/170] Fix setting of push address

glen glen at pld-linux.org
Mon Sep 21 21:43:01 CEST 2015


commit 2dbaafbfefc68cdc56288698f563b8787adea0b1
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Tue Sep 27 15:29:45 2011 +0100

    Fix setting of push address
    
    Fix for a trivial bug: in gitolite every user should push to the same
    account. I knew it, but nevertheless I have coded it wrongly.

 git_slug/gitconst.py |  3 ++-
 slug.py              | 16 +++-------------
 slug.py.txt          | 18 +++++-------------
 3 files changed, 10 insertions(+), 27 deletions(-)
---
diff --git a/git_slug/gitconst.py b/git_slug/gitconst.py
index b068909..a0becdb 100644
--- a/git_slug/gitconst.py
+++ b/git_slug/gitconst.py
@@ -4,10 +4,11 @@ EMPTYSHA1='0000000000000000000000000000000000000000'
 REMOTE_NAME = 'origin'
 REMOTEREFS=join('refs/remotes/',REMOTE_NAME)
 
+GITLOGIN = 'draenog@'
 GITSERVER = 'carme.pld-linux.org'
 _packages_dir = 'packages'
 _packages_remote = join(GITSERVER, _packages_dir)
 GIT_REPO = 'git://' + _packages_remote
-GIT_REPO_PUSH = '@' + _packages_remote
+GIT_REPO_PUSH = 'ssh://' + GITLOGIN + _packages_remote
 REFREPO = 'Refs'
 REFFILE = 'heads'
diff --git a/slug.py b/slug.py
index 038ef7c..0888dd9 100755
--- a/slug.py
+++ b/slug.py
@@ -14,7 +14,7 @@ import argparse
 import signal
 import configparser
 
-from git_slug.gitconst import GITSERVER, GIT_REPO, GIT_REPO_PUSH, REMOTEREFS
+from git_slug.gitconst import GITLOGIN, GITSERVER, GIT_REPO, GIT_REPO_PUSH, REMOTEREFS
 from git_slug.gitrepo import GitRepo, GitRepoError
 from git_slug.refsdata import GitRemoteRefsData, RemoteRefsError
 
@@ -50,8 +50,6 @@ def readconfig(path):
     config = configparser.ConfigParser(delimiters='=', interpolation=None, strict=False)
     config.read(path)
     optionslist = {}
-    if config.has_option('user','email'):
-        optionslist['user'] = config['user']['email'].partition('@')[0]
     for option in ('newpkgs', 'prune'):
         if config.has_option('PLD',option):
             optionslist[option] = config.getboolean('PLD', option)
@@ -67,18 +65,12 @@ def readconfig(path):
 
 def initpackage(name, options):
     repo = GitRepo(os.path.join(options.packagesdir, name))
-    if options.user:
-        remotepush = 'ssh://' + os.path.join(options.user+GIT_REPO_PUSH ,name)
-    else:
-        remotepush = None
+    remotepush = os.path.join(GIT_REPO_PUSH ,name)
     repo.init(os.path.join(GIT_REPO,name), remotepush)
     return repo
 
 def createpackage(name, options):
-    if not options.user:
-        print('user not defined', file=sys.stderr)
-        sys.exit(1)
-    if subprocess.Popen(['ssh', options.user+'@'+GITSERVER, 'create', name]).wait():
+    if subprocess.Popen(['ssh', GITLOGIN + GITSERVER, 'create', name]).wait():
         sys.exit(1)
     initpackage(name, options)
 
@@ -166,8 +158,6 @@ def list_packages(options):
 common_options = argparse.ArgumentParser(add_help=False)
 common_options.add_argument('-d', '--packagesdir', help='local directory with git repositories',
     default=os.path.expanduser('~/PLD_clone/packages'))
-common_options.add_argument('-u', '--user',
-        help='the user name to register for pushes for new repositories')
 
 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)
diff --git a/slug.py.txt b/slug.py.txt
index f3c6a29..8009135 100644
--- a/slug.py.txt
+++ b/slug.py.txt
@@ -9,14 +9,12 @@ slug.py - tool to interact with PLD git repositories
 SYNOPSIS
 --------
 [verse]
-'slug.py clone' [-d dir] [-j <threads>] [-r repository]
-                 [-u user] pattern...
-'slug.py fetch' [-d dir] [-j <threads>] [-r repository]
-                 [-u user] pattern...
-'slug.py init' [-d dir] [-j <threads>] [-u user] package...
+'slug.py clone' [-d dir] [-j <threads>] [-r repository] pattern...
+'slug.py fetch' [-d dir] [-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]
-                 [-r repository] [-u user] pattern...
+                 [-r repository] pattern...
 
 
 DESCRIPTION
@@ -41,11 +39,6 @@ OPTIONS
     The location of special git repository necessary for slug.py operations. By
     default $HOME/PLD_clone/Refs.git is assumed.
 
--u <user>::
---user <user>::
-    the user name to register for pushes in new repositories. If not present value
-    derived from user.email entry in $HOME/.gitconfig is used.
-
 COMMANDS
 --------
 
@@ -92,8 +85,7 @@ CONFIGURATION FILE
 ------------------
 
 The behaviour of slug.py can also be configured with file $HOME/.gitconfig. The
-value of all long options, with the exception of '--user option',  can be
-specified in section [PLD] in this file.
+value of all long options, can be specified in section [PLD] in this file.
 
 AUTHOR
 ------
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list