Thread (24 messages) flat view 24 messages, 5 authors, 2016-06-15

Re: [StGit PATCH 4/9] Convert 'clone' to the use stgit.lib

From: Karl Hasselström <hidden>
Date: 2016-06-15 22:46:41

On 2009-04-28 16:09:57 +0100, Catalin Marinas wrote:
The patch also adds the stgit.lib.git.clone() function.
     if os.path.exists(local_dir):
-        raise CmdException, '"%s" exists. Remove it first' % local_dir
-
-    print 'Cloning "%s" into "%s"...' % (repository, local_dir)
+        raise common.CmdException, '"%s" exists. Remove it first' % local_dir
As recommended by PEP 8, consider using the "raise Exc(args)" syntax:

    - When raising an exception, use "raise ValueError('message')" instead of
      the older form "raise ValueError, 'message'".

      The paren-using form is preferred because when the exception arguments
      are long or include string formatting, you don't need to use line
      continuation characters thanks to the containing parentheses.  The older
      form will be removed in Python 3000.
+def clone(remote, local):
+    """Clone a remote repository using 'git clone'."""
+    run.Run('git', 'clone', remote, local).run()
You don't capture git's output here, but just let it through. Does
that look good in combination with the enclosing out.start() ...
.done() stuff?

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help