1. Ryan Wilcox
  2. hgbb

Commits

Ryan Wilcox  committed 40efb80

added a bb_key_add subcommand to upload SSH keys to BB without needing to copy/paste

  • Participants
  • Parent commits 6774b04
  • Branches default

Comments (0)

Files changed (1)

File hgbb.py

View file
  • Ignore whitespace
             follower['first_name'],
             follower['last_name']))
 
+def bb_key_add(ui, subcommand=None, **opts):
+    """ Upload your SSH key to Bitbucket. (Only works on Unix variants)
+    """
+    
+    ssh_key = open( os.path.expanduser("~/.ssh/id_rsa.pub") ).read()
+    retval = _bb_apicall( ui, "ssh-keys", dict(key=ssh_key) )
+    ui.write("key uploaded...")
+
+
 def clone(orig, ui, source, dest=None, **opts):
     if source[:2] == 'bb' and ':' in source:
         protocol, rest = source.split(':', 1)
            'name of the repo at bitbucket (else guessed from repo dir)'),
           ],
          'hg bbcreate [-d desc] [-l lang] [-w site] reponame'),
+    'bb_key_add':
+        (bb_key_add,
+        [],
+        "hg bb_key_add"),
 }
 
-commands.norepo += ' bbcreate'
+commands.norepo += ' bbcreate bb_key_add'