infocalypse
 
(Steve Dougherty)
2013-07-02: Return inserted URI if it has changed.

Return inserted URI if it has changed.

diff --git a/infocalypse/infcmds.py b/infocalypse/infcmds.py
--- a/infocalypse/infcmds.py
+++ b/infocalypse/infcmds.py
@@ -495,8 +495,13 @@ def is_redundant(uri):
 ############################################################
 # User feedback? success, failure?
 def execute_create(ui_, repo, params, stored_cfg):
-    """ Run the create command. """
+    """
+    Run the create command.
+
+    Return the request URI on success, and None on failure.
+    """
     update_sm = None
+    inserted_to = None
     try:
         update_sm = setup(ui_, repo, params, stored_cfg)
         # REDFLAG: Do better.
@@ -516,9 +521,8 @@ def execute_create(ui_, repo, params, st
         run_until_quiescent(update_sm, params['POLL_SECS'])
 
         if update_sm.get_state(QUIESCENT).arrived_from(((FINISHING,))):
-            ui_.status("Inserted to:\n%s\n" %
-                       '\n'.join(update_sm.get_state(INSERTING_URI).
-                                 get_request_uris()))
+            inserted_to = update_sm.get_state(INSERTING_URI).get_request_uris()
+            ui_.status("Inserted to:\n%s\n" % '\n'.join(inserted_to))
         else:
             ui_.status("Create failed.\n")
 
@@ -526,6 +530,8 @@ def execute_create(ui_, repo, params, st
     finally:
         cleanup(update_sm)
 
+    return inserted_to
+
 # REDFLAG: LATER: make this work without a repo?
 def execute_copy(ui_, repo, params, stored_cfg):
     """ Run the copy command. """