# HG changeset patch # User Chris Cannam # Date 1291383413 0 # Node ID 5b2046f67a5642602e2b0dadaeca0026cd8e6ea3 # Parent 98fa31128e9d244280c14c3544fa31e2111233db * Start using trivial new easyhg extension (requires PyQt) diff -r 98fa31128e9d -r 5b2046f67a56 easyhg.qrc --- a/easyhg.qrc Fri Dec 03 12:32:59 2010 +0000 +++ b/easyhg.qrc Fri Dec 03 13:36:53 2010 +0000 @@ -22,6 +22,7 @@ images/hdd_unmount.png images/hdd_unmount-64.png images/fileopen.png + easyhg.py easyhg_en.qm diff -r 98fa31128e9d -r 5b2046f67a56 filestates.h --- a/filestates.h Fri Dec 03 12:32:59 2010 +0000 +++ b/filestates.h Fri Dec 03 13:36:53 2010 +0000 @@ -35,7 +35,7 @@ Unknown, Removed, Missing, - InConflict + InConflict, FirstState = Clean, LastState = InConflict diff -r 98fa31128e9d -r 5b2046f67a56 hgrunner.cpp --- a/hgrunner.cpp Fri Dec 03 12:32:59 2010 +0000 +++ b/hgrunner.cpp Fri Dec 03 13:36:53 2010 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,8 @@ setTextVisible(false); setVisible(false); m_isRunning = false; + + unbundleExtension(); } HgRunner::~HgRunner() @@ -56,6 +59,27 @@ } } +bool HgRunner::unbundleExtension() +{ + QString bundled = ":easyhg.py"; + QString home = QProcessEnvironment::systemEnvironment().value("HOME"); + QString target = QString("%1/.easyhg").arg(home); + if (!QDir().mkpath(target)) { + DEBUG << "Failed to make unbundle path " << target << endl; + std::cerr << "Failed to make unbundle path " << target.toStdString() << std::endl; + return false; + } + QFile bf(bundled); + m_extensionPath = QString("%1/easyhg.py").arg(target); + if (!bf.copy(m_extensionPath)) { + DEBUG << "Failed to unbundle extension to " << target << endl; + std::cerr << "Failed to unbundle extension to " << m_extensionPath.toStdString() << std::endl; + return false; + } + DEBUG << "Unbundled extension to " << m_extensionPath << endl; + return true; +} + void HgRunner::requestAction(HgAction action) { DEBUG << "requestAction " << action.action << endl; @@ -296,6 +320,18 @@ if (executable == "") { // This is a Hg command executable = getHgBinaryName(); + + if (action.mayBeInteractive()) { + params.push_front("ui.interactive=true"); + params.push_front("--config"); + params.push_front(QString("extensions.easyhg=%1").arg(m_extensionPath)); + params.push_front("--config"); + interactive = true; + } + + //!!! want an option to use the mercurial_keyring extension as well + +/* #ifdef Q_OS_WIN32 // This at least means we won't block on the non-working password prompt params.push_front("--noninteractive"); @@ -309,6 +345,7 @@ params.push_front("--noninteractive"); } #endif +*/ } m_isRunning = true; diff -r 98fa31128e9d -r 5b2046f67a56 hgrunner.h --- a/hgrunner.h Fri Dec 03 12:32:59 2010 +0000 +++ b/hgrunner.h Fri Dec 03 13:36:53 2010 +0000 @@ -65,6 +65,8 @@ void openTerminal(); void closeTerminal(); + bool unbundleExtension(); + int m_ptyMasterFd; int m_ptySlaveFd; QString m_ptySlaveFilename; @@ -77,6 +79,8 @@ QString m_userName; QString m_realm; + + QString m_extensionPath; typedef std::deque ActionQueue; ActionQueue m_queue;