4ad9d3c4ebbe

A bunch of shit
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 09 Dec 2015 12:13:08 +0000
parents b0566e3d38e6
children a87221e612e6
branches/tags (none)
files .hgsubstate bin/unfuck-hggit-mapfile vim/vimrc

Changes

--- a/.hgsubstate	Mon Dec 07 15:48:10 2015 +0000
+++ b/.hgsubstate	Wed Dec 09 12:13:08 2015 +0000
@@ -5,8 +5,8 @@
 d64ce06650cf9b098b5a01c0db53864965d9310b vim/bundle/abolish
 f183a345a0c10caed7684d07dabae33e007c7590 vim/bundle/ack
 6c4663589e73e21e77a9ea8403dcf2bf6cf9c11c vim/bundle/argumentative
-22156d26f2e30050d2e240d5109e5ec5f4dec4b4 vim/bundle/badwolf
-1f8c437ae3c898e5481d1d8d4ca9ecacb79d4edc vim/bundle/bencode
+2bcc153228d77451a22b2cf8cfbb432bae92cc12 vim/bundle/badwolf
+5d747e72d1f2e9bdd1d3f3a1375faabf5fe00313 vim/bundle/bencode
 8533fffd9fbb690dfc8e334f91a10c72e35a6dce vim/bundle/clam
 5201a3860dbc32814f44eaf9386245caa70a65e6 vim/bundle/clojure-static
 dc349bb7d30f713d770fc1fa0fe209e6aab82dc8 vim/bundle/commentary
@@ -17,7 +17,7 @@
 935a2cccd3065b1322fb2235285d42728600afdf vim/bundle/fugitive
 6e9f52a160e3d15060848a8f453bd1b5bfa70db2 vim/bundle/gnupg
 0d57b080f9fae8573c688b6679b31eb1666edc4c vim/bundle/gnuplot
-eb9fc8676b8959c3c2c95bf6b6e8f0f44317c5c0 vim/bundle/gundo
+1be6a45c04c830b9b1841b4510a5651c5c2eafdb vim/bundle/gundo
 34b407d2344a3c2a94b56e9d443e18e01e8544d9 vim/bundle/html5
 78fffa609b3e6b84ef01ee4c9aba6d7435d7b18e vim/bundle/indent-object
 d1f19733ff5594cf5d6fb498fc599f02326860a6 vim/bundle/jack
--- a/bin/unfuck-hggit-mapfile	Mon Dec 07 15:48:10 2015 +0000
+++ b/bin/unfuck-hggit-mapfile	Wed Dec 09 12:13:08 2015 +0000
@@ -21,11 +21,11 @@
     sys.exit(1)
 
 def hg(*args):
-    l = ["hg", "--repository", "./" + hg_dir] + list(args)
+    l = ["hg", "--repository", hg_dir] + list(args)
     return subprocess.check_output(l).strip()
 
 def git(*args):
-    l = ["git", "-C", "./" + git_dir] + list(args)
+    l = ["git", "-C", git_dir] + list(args)
     return subprocess.check_output(l).strip()
 
 def find_hg_root_revision():
@@ -48,6 +48,15 @@
             result[parent].append(parts[0])
     return result
 
+def find_hg_children_mapping():
+    result = collections.defaultdict(list)
+    for l in hg('log', '--template', '{node} {p1node} {p2node}\\n').split('\n'):
+        parts = l.split()
+        for parent in parts[1:]:
+            if parent != "0000000000000000000000000000000000000":
+                result[parent].append(parts[0])
+    return result
+
 def find_hg_children(rev):
     return hg('log', '-r', 'children(%s)' % rev, nodetempl).split()
 
@@ -59,6 +68,7 @@
 
 hg_root = find_hg_root_revision()
 git_root = find_git_root_revision()
+hg_children_map = find_hg_children_mapping()
 git_children_map = find_git_children_mapping()
 
 # hg -> git
@@ -67,32 +77,42 @@
 
 n = 0
 while todo:
-    log(n)
-    n += 1
     h = todo.pop()
     g = mapping[h]
-    hg_children = find_hg_children(h)
+
+    log("%4d %s %s" % (n, h[:12], g[:12]))
+
+    n += 1
+
+    hg_children = hg_children_map[h]
     git_children = git_children_map[g]
 
-    if len(hg_children) == len(git_children) == 1:
+    if len(hg_children) == len(git_children) == 0:
+        log("Head node, no children...")
+    elif len(hg_children) == len(git_children) == 1:
         if hg_children[0] not in mapping:
             mapping[hg_children[0]] = git_children[0]
             todo.append(hg_children[0])
     else:
-        log("Multiple children, attempting to differentiate")
+        log("Multiple (%d hg / %d git) children, attempting to differentiate" %
+            (len(hg_children), len(git_children)))
         for hg_child in hg_children:
             hg_desc = get_hg_desc(hg_child)
             matching = [
                 git_child for git_child in git_children
-                if hg_desc.startswith(get_git_desc(git_child))
+                if hg_desc.startswith(get_git_desc(git_child).split('\n')[0])
             ]
             if len(matching) == 1:
                 log("Found a match based on message for %s" % hg_child)
                 if hg_child not in mapping:
                     mapping[hg_child] = matching[0]
                     todo.append(hg_child)
+                else:
+                    log("already done, skipping...")
+            elif len(matching) == 0:
+                log("no match found...")
             else:
-                log("no match found...")
+                log("multiple matches found...")
 
 
 for h, g in mapping.items():
--- a/vim/vimrc	Mon Dec 07 15:48:10 2015 +0000
+++ b/vim/vimrc	Wed Dec 09 12:13:08 2015 +0000
@@ -835,7 +835,7 @@
     NeoRepl lisp
     set syntax=lisp
     syn match replPrompt /\v^\*/
-    hi def link replPrompt SpecialChar
+    syn match replPrompt /\v^[-_a-zA-Z]+\>/
 
     syn match replResult /\v^#\<[^>]+\>$/
     hi def link replResult Debug
@@ -851,6 +851,8 @@
     set lispwords+=cswitch
     set lispwords+=eswitch
     set lispwords+=when-let
+    set lispwords+=optima:match
+    set lispwords+=match
 endfunction "}}}
 function! SendLispForm() "{{{
     let view = winsaveview()
@@ -940,6 +942,9 @@
     " Describe symbol under the cursor
     au FileType lisp nnoremap <buffer> <silent> <localleader>d :call DescribeLispSymbol()<cr>
 
+    " Describe the last thing we typed
+    au FileType lisp inoremap <buffer> <silent> <c-d> <esc>mzb:call DescribeLispSymbol()<cr>`za
+
     " Describe prompt
     au FileType lisp nnoremap <buffer> <silent> <localleader>D :call DescribeLispPrompt()<cr>
 
@@ -971,6 +976,9 @@
     " Indent top-level form.
     au FileType lisp nmap <buffer> <localleader>= mz:silent normal99[(<cr>v%='z
     " ])
+
+    " s/it/happening/
+    au FileType lisp silent! call OozeMapKeys()
 augroup END
 
 " }}}
@@ -2569,7 +2577,7 @@
 nnoremap <leader>hD :HgDiff<cr>
 
 " Diff the entire repo
-nnoremap <leader>hd :Clam hg diff<cr>:set ft=diff nowrap foldlevel=1<cr>gg
+nnoremap <leader>hd :wa<cr>:Clam hg diff<cr>:set ft=diff nowrap foldlevel=1<cr>gg
 
 function! s:HgBlame() " {{{
     let fn = expand('%:p')