/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/command/init.py

  • Committer: Tim Marston
  • Date: 2021-07-05 19:14:32 UTC
  • Revision ID: tim@ed.am-20210705191432-243ayb7s2nmussvi
python3ification

Show diffs side-by-side

added added

removed removed

20
20
 
21
21
 
22
22
import sys, os, re, getopt, shutil, subprocess
23
 
from command import Command
 
23
from .command import Command
24
24
import stdhome.the as the
25
25
from stdhome.deployment import Deployment
26
26
 
34
34
 
35
35
 
36
36
        def print_help( self ):
37
 
                print "Usage: " + the.program.name + " init [URL] [--repo=REPO]"
38
 
                print
 
37
                print("Usage: " + the.program.name + " init [URL] [--repo=REPO]")
 
38
                print()
39
39
                #      01234567890123456789012345678901234567890123456789012345678901234567890123456789
40
 
                print "Initialise a local repository."
41
 
                print
42
 
                print "If an URL is given, the local reposity is a checkout of it (i.e., you can"
43
 
                print "receive updates from it and changes you commit will be sent to it).  The URL"
44
 
                print "can take the form of a simple hostname, such as \"example.com\", or it can be a"
45
 
                print "fully-qualified bazaar URL.  (Actually, in the first case, where it is a simple"
46
 
                print "hostname, it is internally expanded to scp://HOSTNAME/~/.stdhome/REPO)."
47
 
                print
48
 
                print "Options:"
49
 
                print "      --quiet      do not report changes to the home directory"
50
 
                print "  -r, --repo=REPO  select the repo to check-out or create (defaults to 'home')"
51
 
                print "  -v, --verbose    display information about what is being done"
52
 
                print "      --vcs=VCS    select the version control system"
53
 
                print "      --help       display help and exit"
 
40
                print("Initialise a local repository.")
 
41
                print()
 
42
                print("If an URL is given, the local reposity is a checkout of it (i.e., you can")
 
43
                print("receive updates from it and changes you commit will be sent to it).  The URL")
 
44
                print("can take the form of a simple hostname, such as \"example.com\", or it can be a")
 
45
                print("fully-qualified bazaar URL.  (Actually, in the first case, where it is a simple")
 
46
                print("hostname, it is internally expanded to scp://HOSTNAME/~/.stdhome/REPO).")
 
47
                print()
 
48
                print("Options:")
 
49
                print("      --quiet      do not report changes to the home directory")
 
50
                print("  -r, --repo=REPO  select the repo to check-out or create (defaults to 'home')")
 
51
                print("  -v, --verbose    display information about what is being done")
 
52
                print("      --vcs=VCS    select the version control system")
 
53
                print("      --help       display help and exit")
54
54
                exit( 0 )
55
55
 
56
56
 
106
106
                        deployment.copy_in()
107
107
 
108
108
                        # perform bzr checkout
109
 
                        if the.verbose >= 1: print "checking out %s" % the.repo.dir
 
109
                        if the.verbose >= 1: print("checking out %s" % the.repo.dir)
110
110
                        try:
111
111
                                the.repo.vcs.checkout( self.url )
112
112
                        except Exception:
139
139
                else:
140
140
 
141
141
                        # perform bzr init
142
 
                        if the.verbose >= 1: print 'initialising %s' % the.repo.dir
 
142
                        if the.verbose >= 1: print('initialising %s' % the.repo.dir)
143
143
                        try:
144
144
                                the.repo.vcs.init()
145
145
                        except Exception: