]> Cypherpunks repositories - gostls13.git/commitdiff
codereview: save CL messages in $(hg root)/last-change
authorRuss Cox <rsc@golang.org>
Tue, 20 Sep 2011 18:56:15 +0000 (14:56 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 20 Sep 2011 18:56:15 +0000 (14:56 -0400)
Fixes #2279.

R=bradfitz, r, r
CC=golang-dev
https://golang.org/cl/5096042

.hgignore
lib/codereview/codereview.py

index e8bd79c9e9b1a2ccfafebd1b556882407040990b..31f752dba22ed4ffd733d25f366a4bbe00a20bec 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -61,6 +61,7 @@ test/run.out
 test/times.out
 test/garbage/*.out
 goinstall.log
+last-change
 
 syntax:regexp
 ^bin/
index 1b70a29c6ce39d12780ff7052ca7b19bca3012ff..761476371b9a1bab2be8d3a29c1d3d12796270f0 100644 (file)
@@ -849,6 +849,18 @@ def EditCL(ui, repo, cl):
        s = cl.EditorText()
        while True:
                s = ui.edit(s, ui.username())
+               
+               # We can't trust Mercurial + Python not to die before making the change,
+               # so, by popular demand, just scribble the most recent CL edit into
+               # $(hg root)/last-change so that if Mercurial does die, people
+               # can look there for their work.
+               try:
+                       f = open(repo.root+"/last-change", "w")
+                       f.write(s)
+                       f.close()
+               except:
+                       pass
+
                clx, line, err = ParseCL(s, cl.name)
                if err != '':
                        if not promptyesno(ui, "error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err)):