# HG changeset patch # User Chris Cannam # Date 1300384098 0 # Node ID f89e50d748ed1eb36fbc63d0eed987b1b7b43354 # Parent 73fb5ef55744c8f1e02d4946f5dacdffda6568d3 Enable Push button whenever the repo is non-empty, even when there is no remote location -- ask for remote location when it is pressed. Also change "Change Remote..." to "Set Remote..." to be consistent with this new usage diff -r 73fb5ef55744 -r f89e50d748ed mainwindow.cpp --- a/mainwindow.cpp Thu Mar 17 17:34:40 2011 +0000 +++ b/mainwindow.cpp Thu Mar 17 17:48:18 2011 +0000 @@ -1005,6 +1005,11 @@ void MainWindow::hgPush() { + if (m_remoteRepoPath.isEmpty()) { + changeRemoteRepo(true); + if (m_remoteRepoPath.isEmpty()) return; + } + QString uncommittedNote; if (m_hgTabs->canCommit()) { uncommittedNote = tr("

Note: You have uncommitted changes. If you want to push these changes to the remote repository, you need to commit them first."); @@ -1187,6 +1192,11 @@ void MainWindow::changeRemoteRepo() { + changeRemoteRepo(false); +} + +void MainWindow::changeRemoteRepo(bool initial) +{ // This will involve rewriting the local .hgrc QDir hgDir(m_workFolderPath + "/.hg"); @@ -1202,13 +1212,20 @@ } MultiChoiceDialog *d = new MultiChoiceDialog - (tr("Change Remote Location"), - tr("Change the remote location"), + (tr("Set Remote Location"), + tr("Set the remote location"), this); + QString explanation; + if (initial) { + explanation = tr("Provide a URL to use for push and pull actions from the current local repository.
This will be the default for subsequent pushes and pulls.
You can change it using “Set Remote Location” on the File menu."); + } else { + explanation = tr("Provide a new URL to use for push and pull actions from the current local repository."); + } + d->addChoice("remote", tr("


Remote repository
"), - tr("Provide a new URL to use for push and pull actions from the current local repository."), + explanation, MultiChoiceDialog::UrlArg); if (d->exec() == QDialog::Accepted) { @@ -2435,10 +2452,6 @@ localRepoExist = false; } - m_hgIncomingAct -> setEnabled(m_remoteRepoActionsEnabled && m_remoteRepoActionsEnabled); - m_hgPullAct -> setEnabled(m_remoteRepoActionsEnabled && m_remoteRepoActionsEnabled); - m_hgPushAct -> setEnabled(m_remoteRepoActionsEnabled && m_remoteRepoActionsEnabled); - bool haveDiff = false; QSettings settings; settings.beginGroup("Locations"); @@ -2529,6 +2542,11 @@ m_justMerged = true; } + m_hgIncomingAct->setEnabled(m_remoteRepoActionsEnabled); + m_hgPullAct->setEnabled(m_remoteRepoActionsEnabled); + // permit push even if no remote yet; we'll ask for one + m_hgPushAct->setEnabled(m_localRepoActionsEnabled && !emptyRepo); + m_hgMergeAct->setEnabled(m_localRepoActionsEnabled && (canMerge || m_hgTabs->canResolve())); m_hgUpdateAct->setEnabled(m_localRepoActionsEnabled && @@ -2600,8 +2618,8 @@ m_openAct = new QAction(QIcon(":/images/fileopen.png"), tr("Open..."), this); m_openAct -> setStatusTip(tr("Open an existing repository or working folder")); - m_changeRemoteRepoAct = new QAction(tr("Change Remote Location..."), this); - m_changeRemoteRepoAct->setStatusTip(tr("Change the default remote repository for pull and push actions")); + m_changeRemoteRepoAct = new QAction(tr("Set Remote Location..."), this); + m_changeRemoteRepoAct->setStatusTip(tr("Set or change the default remote repository for pull and push actions")); m_settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this); m_settingsAct -> setStatusTip(tr("View and change application settings")); diff -r 73fb5ef55744 -r f89e50d748ed mainwindow.h --- a/mainwindow.h Thu Mar 17 17:34:40 2011 +0000 +++ b/mainwindow.h Thu Mar 17 17:48:18 2011 +0000 @@ -60,6 +60,7 @@ void open(); void recentMenuActivated(); void changeRemoteRepo(); + void changeRemoteRepo(bool initial); void startupDialog(); void clearSelections(); void showAllChanged(bool);