[PATCH] blackbox: add backup bundle paths to blackbox logs

Durham Goode durham at fb.com
Wed Mar 13 12:59:45 CDT 2013


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1363196631 25200
#      Wed Mar 13 10:43:51 2013 -0700
# Node ID 2a50122dd4e45e3f8f83b6d72ac0fc5f8791ccce
# Parent  a039d7868d8546d0f83d46f28e720890a6e9594a
blackbox: add backup bundle paths to blackbox logs

Writes the backup bundle paths to the blackbox so it's easy to see which
backup bundle is associated with which command when you are debugging an
issue.

Example output:

2013/03/13 10:39:56 durham> strip tip
2013/03/13 10:39:59 durham> saved backup bundle to /data/users/durham/www-hg/.hg/strip-backup/e5fac262363a-backup.hg
2013/03/13 10:40:03 durham> strip tip exited 0 after 7.97 seconds

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -119,6 +119,7 @@
     if backup == "all":
         backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
         repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
+        repo.ui.log("backupbundle", "saved backup bundle to %s\n", backupfile)
     if saveheads or savebases:
         # do not compress partial bundle if we remove it from disk later
         chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -16,6 +16,7 @@
   > [extensions]
   > blackbox=
   > mock=`pwd`/mock.py
+  > mq=
   > EOF
   $ hg init blackboxtest
   $ cd blackboxtest
@@ -60,6 +61,20 @@
   1970/01/01 00:00:00 bob> 1 incoming changes - new heads: d02f48003e62
   1970/01/01 00:00:00 bob> pull exited None after * seconds (glob)
 
+backup bundles get logged
+
+  $ touch d
+  $ hg commit -Amd
+  adding d
+  created new head
+  $ hg strip tip
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
+  $ hg blackbox -l 3
+  1970/01/01 00:00:00 bob> strip tip
+  1970/01/01 00:00:00 bob> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
+  1970/01/01 00:00:00 bob> strip exited 0 after * seconds (glob)
+
 extension and python hooks - use the eol extension for a pythonhook
 
   $ echo '[extensions]' >> .hg/hgrc


More information about the Mercurial-devel mailing list