Commits

Graham Helliwell committed dd8a20d Merge

Merge with default

Comments (0)

Files changed (2)

guestrepo/__init__.py

           'may become unordered '
           'when more than one thread is used', 'THREADS')]
 
+silentnoop = [('s', 'silentnoop', False,
+           "consider the operation a success if no guest repository config exists")]
+
 # Command table for the guestrepo extension
 # See the readme for a description of each command
 # format: {"command-name": (function, options-list, help-string)}
 cmdtable = {
    "grpull": (grpull,
-              localopt + threadopt + updateopt + forcepartialopt,
+              localopt + threadopt + updateopt + forcepartialopt + silentnoop,
               "hg grpull [REPO [+]] [options]"),
    "grpush": (grpush,
-              localopt + threadopt + forcepartialopt,
+              localopt + threadopt + forcepartialopt + silentnoop,
               "hg grpush [REPO [+]] [options]"),
    "grupdate": (grupdate,
-              localopt + threadopt + pullopt + forcepartialopt,
+              localopt + threadopt + pullopt + forcepartialopt + silentnoop,
               "hg grupdate [REPO [+]] [options]"),
    "grfreeze": (freeze,
               [],

guestrepo/guestrepo.py

 #####################
 
 def repoactions(ui, repo, orderedactions, args, opts):
-    '''Assumes orderedactions is non-empty. Returns true iff all actions fail.'''
+    '''Assumes orderedactions is a non-empty list of actions which return True on success.
+     Returns 1 iff one or more actions fail.'''
     local = opts.get('local')
     mapping = 'local' if local else True
     continueOnError = opts.get('forcepartial')
+    silentnoguests = opts.get('silentnoop')
 
     try:
         guests = getguests(repo, None, continueOnError)
     except IOError:
-        ui.warn("No guest repositories are configured for repository at '{0}'.\n".format(repo.origroot))
-        return 0
+        ui.warn(" no guest repositories defined for '{0}'.\n".format(os.path.basename(repo.origroot)))
+        return not silentnoguests
 
     if args:
        guests = matchguests(repo.root, os.getcwd(), args, guests)
 
-    failures = list(not action(ui, repo, mapping, guests, opts) for action in orderedactions )
-    return any(failures)
+    failed = list(not action(ui, repo, mapping, guests, opts) for action in orderedactions )
+    return any(failed)
 
 def pull(ui, repo, mapping, guests, opts):
+    '''Return true on success'''
     def pullaction(ui, repo, guest):
         ui.status('pulling %s\n' % guest.canonpath)
         commands.pull(ui, repo, guest.uri)
 
-    runparallelaction(ui, repo, mapping, guests, pullaction, True, opts)
+    return runparallelaction(ui, repo, mapping, guests, pullaction, True, opts)
 
 def update(ui, repo, mapping, guests, opts):
+    '''Return true on success'''
     local = mapping=='local'
     path = dirtyrecursive(ui, repo, local, guests)
     if path:
         warnbranch(ui, guest.name, repo, guest.csid)
         commands.update(ui, repo, guest.csid)
 
-    runparallelaction(ui, repo, mapping, guests, updateaction, True, opts)
+    return runparallelaction(ui, repo, mapping, guests, updateaction, True, opts)
 
 def push(ui, repo, mapping, guests, opts):
+    '''Return true on success'''
     def pushaction(ui, repo, guest):
         commands.push(ui, repo, guest.uri)
-    runparallelaction(ui, repo, mapping, guests, pushaction, False, opts)
+    return runparallelaction(ui, repo, mapping, guests, pushaction, False, opts)
 
 def runparallelaction(ui, repo, mapping, guests, action, create, opts):
     workers = makeworkers(ui, opts)