infocalypse
 
(Steve Dougherty)
2013-08-30: Set default-push when creating a repo with clone.

Set default-push when creating a repo with clone. This allows updating the repo with hg push. Previously only the request URI was defined, which Infocalypse could not reverse into an insert URI. Also resolves a clone path bug: fixed in fb4b23fd7089 Also adds a bug. Also always prints identity when resolved.

diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -1,5 +1,6 @@
 minimize dependencies                                        | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:0fc25f7b84f3e1fb89e9134a28eeabbe76bf054f, time:1372231529.45
 Problems using clone to create repositories.~                | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:210c0e45adba5d500c6c5c00d750bfe43824cd3a, time:1375737210.02
+Update USK hgrc paths                                        | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:2a4a5dfd11551f488701997054d6547ac586165a, time:1377872619.04
 Add command to reinsert repo list.                           | owner:, open:False, id:2dcc27c850209062080906368530b4b9202271d0, time:1373407233.84
 pull fails, because config.get_wot_identity requests self.defaults['DEFAULT_TRUSTER'] which is not in defaults. | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:31beb672d404944a4655a546b21c95c7baa91002, time:1371735138.39
 cloning from a freenet:// uri does not work right now.       | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:35584408d800bb895d52dcf86cfba12c5b3237dd, time:1373100583.27
@@ -9,10 +10,10 @@ set the timezone to UTC on cloning a fre
 mime-type problems                                           | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:5916e6e8328e20d8b0276b76b7116dd432730778, time:1353463866.97
                                                              | owner:, open:False, id:65d8d544370f80538e325dae0b6c2da449c5bcfe, time:1373407147.03
 Add --truster support to built-in commands.                  | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:673a3103a58988552e0ef0b0ab20e8c75c9f6b1f, time:1375736861.8
-add support for hg incoming freenet://…                      | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:dbff86d4bba0e38adb81a6e27e7180282222f541, time:1375002083.32
 Add i18n support for messages.                               | owner:, open:True, id:7760991aef41c6d38be5315f742f6a6f350a0a76, time:1375010635.52
-Fix implied clone destination when cloning from freenet:.    | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:9bd3ef617ba8871d28fbdae2500542e93302c791, time:1375736289.27
+Fix implied clone destination when cloning from freenet:.    | owner:Steve Dougherty <steve@asksteved.com>, open:False, id:9bd3ef617ba8871d28fbdae2500542e93302c791, time:1375736289.27
 Unit tests involving the node are hard.                      | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:b01a53e59a2096254ecacdcee7673df5323d786e, time:1375737309.25
 Consider reworking repo list XML for conciseness.            | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:b511106032c58ffe7b33d0eb65bac7ec5555575e, time:1375734587.66
 simpler-wot-uris: name/repo                                  | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:d4f2df3ca2c441e4be389be846634f5a4a08906e, time:1372232568.9
+add support for hg incoming freenet://…                    | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:dbff86d4bba0e38adb81a6e27e7180282222f541, time:1375002083.32
 Add a warning that comments and unrecognized entries in ~/.infocalypse are removed. | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:e9236fdd23d44bfbf8565bb1a59317289f324fd6, time:1375735601.35
diff --git a/.bugs/details/2a4a5dfd11551f488701997054d6547ac586165a.txt b/.bugs/details/2a4a5dfd11551f488701997054d6547ac586165a.txt
new file mode 100644
--- /dev/null
+++ b/.bugs/details/2a4a5dfd11551f488701997054d6547ac586165a.txt
@@ -0,0 +1,27 @@
+# Lines starting with '#' and sections without content
+# are not displayed by a call to 'details'
+#
+[paths]
+# Paths related to this bug.
+# suggested format: REPO_PATH:LINENUMBERS
+
+
+[details]
+# Additional details
+Once a freenet: path is added to the hgrc, if it's a USK, how should its
+edition be updated? Stale editions are not as helpful.
+
+[expected]
+# The expected result
+
+
+[actual]
+# What happened instead
+
+
+[reproduce]
+# Reproduction steps
+
+
+[comments]
+# Comments and updates - leave your name
diff --git a/infocalypse/__init__.py b/infocalypse/__init__.py
--- a/infocalypse/__init__.py
+++ b/infocalypse/__init__.py
@@ -781,7 +781,12 @@ def freenetclone(orig, *args, **opts):
             #pushuri = pushuri[:namepartpos] + namepart
         opts["uri"] = pushuri
         repo = hg.repository(ui, ui.expandpath(source))
-        return infocalypse_create(ui, repo, **opts)
+        infocalypse_create(ui, repo, **opts)
+
+        with repo.opener("hgrc", "a", text=True) as f:
+            f.write("""[paths]
+default-push = freenet:{0}
+""".format(pushuri))
 
     if action == "pull":
         if os.path.exists(dest):
diff --git a/infocalypse/commands.py b/infocalypse/commands.py
--- a/infocalypse/commands.py
+++ b/infocalypse/commands.py
@@ -68,12 +68,8 @@ def infocalypse_create(ui_, repo, **opts
 
         from wot_id import Local_WoT_ID
 
-        ui_.status("Querying WoT for local identities.\n")
-
         local_id = Local_WoT_ID(nick_prefix)
 
-        ui_.status('Found {0}\n'.format(local_id))
-
         insert_uri = local_id.insert_uri.clone()
 
         insert_uri.name = repo_name
diff --git a/infocalypse/wot_id.py b/infocalypse/wot_id.py
--- a/infocalypse/wot_id.py
+++ b/infocalypse/wot_id.py
@@ -36,6 +36,7 @@ class WoT_ID(object):
         # a WoT_ID for a Local_WoT_ID. Their default values parse the first
         # (and only) identity described by an unspecified message, in which case
         # it queries WoT to produce one.
+        is_local_identity = message is not None
         if not message:
             message = _get_identity(wot_identifier, truster)
 
@@ -90,6 +91,12 @@ class WoT_ID(object):
             self.freemail_address = string.lower(self.nickname + '@' + re_encode
                                                  + '.freemail')
 
+        # TODO: Would it be preferable to use ui to obey quieting switches?
+        if is_local_identity:
+            print("Using local identity {0}".format(self))
+        else:
+            print("Using identity {0}".format(self))
+
     def __str__(self):
         return self.nickname + '@' + self.identity_id