Mercurial > hg > easyhg
comparison hgrunner.cpp @ 172:b6dd1ee0e486
* Fix failure to recognise local uncommitted changes when an untracked file was selected
* Win32: Look in installed location (currently just the location of the present .exe) for executables as well as in path
* Win32: Search for easyhg extension in same way as executables
* Win32: Set installed location to path when running hg commands (for dependent DLLs)
author | Chris Cannam |
---|---|
date | Wed, 15 Dec 2010 22:07:31 +0000 |
parents | 0dfd6567ec0c |
children | 6def8bf3be44 |
comparison
equal
deleted
inserted
replaced
171:aab308a3b304 | 172:b6dd1ee0e486 |
---|---|
37 #include <unistd.h> | 37 #include <unistd.h> |
38 #include <termios.h> | 38 #include <termios.h> |
39 #include <fcntl.h> | 39 #include <fcntl.h> |
40 #endif | 40 #endif |
41 | 41 |
42 HgRunner::HgRunner(QWidget * parent): QProgressBar(parent) | 42 HgRunner::HgRunner(QString myDirPath, QWidget * parent) : |
43 QProgressBar(parent), | |
44 m_myDirPath(myDirPath) | |
43 { | 45 { |
44 m_proc = 0; | 46 m_proc = 0; |
45 | 47 |
46 setTextVisible(false); | 48 setTextVisible(false); |
47 setVisible(false); | 49 setVisible(false); |
48 m_isRunning = false; | 50 m_isRunning = false; |
49 | 51 |
50 unbundleExtension(); | 52 findExtension(); |
51 } | 53 } |
52 | 54 |
53 HgRunner::~HgRunner() | 55 HgRunner::~HgRunner() |
54 { | 56 { |
55 closeTerminal(); | 57 closeTerminal(); |
56 if (m_proc) { | 58 if (m_proc) { |
57 m_proc->kill(); | 59 m_proc->kill(); |
58 m_proc->deleteLater(); | 60 m_proc->deleteLater(); |
59 } | 61 } |
60 } | 62 } |
63 | |
64 void HgRunner::findExtension() | |
65 { | |
66 m_extensionPath = findInPath("easyhg.py", m_myDirPath, false); | |
67 if (m_extensionPath == "easyhg.py") { | |
68 if (!unbundleExtension()) { | |
69 m_extensionPath = ""; | |
70 } | |
71 } | |
72 } | |
61 | 73 |
62 bool HgRunner::unbundleExtension() | 74 bool HgRunner::unbundleExtension() |
63 { | 75 { |
64 QString bundled = ":easyhg.py"; | 76 QString bundled = ":easyhg.py"; |
65 QString home = QDir::homePath(); | 77 QString home = QDir::homePath(); |
106 QString HgRunner::getHgBinaryName() | 118 QString HgRunner::getHgBinaryName() |
107 { | 119 { |
108 QSettings settings; | 120 QSettings settings; |
109 QString hg = settings.value("hgbinary", "").toString(); | 121 QString hg = settings.value("hgbinary", "").toString(); |
110 if (hg == "") { | 122 if (hg == "") { |
111 hg = findExecutable("hg"); | 123 hg = findInPath("hg", m_myDirPath, true); |
112 } | 124 } |
113 if (hg != "hg") { | 125 if (hg != "hg") { |
114 settings.setValue("hgbinary", hg); | 126 settings.setValue("hgbinary", hg); |
115 } | 127 } |
116 return hg; | 128 return hg; |
341 m_userName = ""; | 353 m_userName = ""; |
342 | 354 |
343 m_proc = new QProcess; | 355 m_proc = new QProcess; |
344 | 356 |
345 QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | 357 QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); |
358 | |
359 #ifdef Q_OS_WIN32 | |
360 if (m_myDirPath != "") { | |
361 env.insert("PATH", m_myDirPath + ";" + env.value("PATH")); | |
362 } | |
363 #endif | |
364 | |
346 env.insert("LANG", "en_US.utf8"); | 365 env.insert("LANG", "en_US.utf8"); |
347 env.insert("LC_ALL", "en_US.utf8"); | 366 env.insert("LC_ALL", "en_US.utf8"); |
348 env.insert("HGPLAIN", "1"); | 367 env.insert("HGPLAIN", "1"); |
349 m_proc->setProcessEnvironment(env); | 368 m_proc->setProcessEnvironment(env); |
350 | 369 |