diff options
Diffstat (limited to 'subcmds/checkout.py')
-rw-r--r-- | subcmds/checkout.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/subcmds/checkout.py b/subcmds/checkout.py index 07644c95..4198acd1 100644 --- a/subcmds/checkout.py +++ b/subcmds/checkout.py | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | import sys | 16 | import sys |
17 | from command import Command | 17 | from command import Command |
18 | from progress import Progress | ||
18 | 19 | ||
19 | class Checkout(Command): | 20 | class Checkout(Command): |
20 | common = True | 21 | common = True |
@@ -35,13 +36,23 @@ The command is equivalent to: | |||
35 | if not args: | 36 | if not args: |
36 | self.Usage() | 37 | self.Usage() |
37 | 38 | ||
38 | retValue = 0; | 39 | nb = args[0] |
39 | 40 | err = [] | |
40 | branch = args[0] | 41 | all = self.GetProjects(args[1:]) |
41 | for project in self.GetProjects(args[1:]): | 42 | |
42 | if not project.CheckoutBranch(branch): | 43 | pm = Progress('Checkout %s' % nb, len(all)) |
43 | retValue = 1; | 44 | for project in all: |
44 | print >>sys.stderr, "error: checking out branch '%s' in %s failed" % (branch, project.name) | 45 | pm.update() |
45 | 46 | if not project.CheckoutBranch(nb): | |
46 | if (retValue != 0): | 47 | err.append(project) |
47 | sys.exit(retValue); | 48 | pm.end() |
49 | |||
50 | if err: | ||
51 | if len(err) == len(all): | ||
52 | print >>sys.stderr, 'error: no project has branch %s' % nb | ||
53 | else: | ||
54 | for p in err: | ||
55 | print >>sys.stderr,\ | ||
56 | "error: %s/: cannot checkout %s" \ | ||
57 | % (p.relpath, nb) | ||
58 | sys.exit(1) | ||