Skip to content

Commit

Permalink
#5662: UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jul 21, 2021
1 parent aba24b6 commit dbe535e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 31 deletions.
8 changes: 4 additions & 4 deletions install/ui/vcsstatusbar.fbp
Expand Up @@ -251,7 +251,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
Expand Down Expand Up @@ -290,7 +290,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">NumOutgoingCommits</property>
<property name="name">NumIncomingCommits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
Expand Down Expand Up @@ -370,7 +370,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
Expand Down Expand Up @@ -409,7 +409,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">NumIncomingCommits</property>
<property name="name">NumOutgoingCommits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
Expand Down
8 changes: 4 additions & 4 deletions install/ui/vcsstatusbar.xrc
Expand Up @@ -43,9 +43,9 @@
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_VERTICAL</flag>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>0</border>
<object class="wxStaticText" name="NumOutgoingCommits">
<object class="wxStaticText" name="NumIncomingCommits">
<label>1</label>
<wrap>-1</wrap>
</object>
Expand All @@ -61,9 +61,9 @@
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>0</border>
<object class="wxStaticText" name="NumIncomingCommits">
<object class="wxStaticText" name="NumOutgoingCommits">
<label>1</label>
<wrap>-1</wrap>
</object>
Expand Down
46 changes: 26 additions & 20 deletions plugins/vcs/Algorithm.h
Expand Up @@ -257,12 +257,11 @@ inline void syncWithRemote(const std::shared_ptr<Repository>& repository)
git_merge_analysis_t analysis;
git_merge_preference_t preference = GIT_MERGE_PREFERENCE_NONE;

git_annotated_commit* mergeHead;

auto upstream = repository->getHead()->getUpstream();
git_oid upstreamOid;
auto error = git_reference_name_to_id(&upstreamOid, repository->_get(), upstream->getName().c_str());

git_annotated_commit* mergeHead;
error = git_annotated_commit_lookup(&mergeHead, repository->_get(), &upstreamOid);
GitException::ThrowOnError(error);

Expand All @@ -288,28 +287,35 @@ inline void syncWithRemote(const std::shared_ptr<Repository>& repository)
GitException::ThrowOnError(error);

// Check if the loaded map is affected by the merge
if (status.strategy == RequiredMergeStrategy::MergeMap)
if (status.strategy != RequiredMergeStrategy::MergeMap)
{
auto mergeBase = repository->findMergeBase(*repository->getHead(), *upstream);

auto baseUri = constructVcsFileUri(GitModule::UriPrefix, Reference::OidToString(mergeBase->getOid()), mapPath);
auto sourceUri = constructVcsFileUri(GitModule::UriPrefix, Reference::OidToString(&upstreamOid), mapPath);

try
{
// The loaded map merge needs to be confirmed by the user
GlobalMapModule().startMergeOperation(sourceUri, baseUri);
}
catch (const cmd::ExecutionFailure& ex)
{
throw GitException(ex.what());
}

// Wait until the user finishes or aborts the merge
tryToFinishMerge(repository);
return;
}

tryToFinishMerge(repository);
// A map merge is required
wxutil::Messagebox::Show(_("Map Merge Required"),
_("The map has been changed both on the server and locally.\n"
"DarkRadiant will now switch to Merge Mode to highlight the differences.\n"
"Please have a look, resolve possible conflicts and finish the merge."),
::ui::IDialog::MessageType::MESSAGE_CONFIRM);

auto mergeBase = repository->findMergeBase(*repository->getHead(), *upstream);

auto baseUri = constructVcsFileUri(GitModule::UriPrefix, Reference::OidToString(mergeBase->getOid()), mapPath);
auto sourceUri = constructVcsFileUri(GitModule::UriPrefix, Reference::OidToString(&upstreamOid), mapPath);

try
{
// The loaded map merge needs to be confirmed by the user
GlobalMapModule().startMergeOperation(sourceUri, baseUri);
// Done here, wait until the user finishes or aborts the merge
return;
}
catch (const cmd::ExecutionFailure& ex)
{
throw GitException(ex.what());
}
}
catch (const GitException& ex)
{
Expand Down
6 changes: 3 additions & 3 deletions plugins/vcs/ui/VcsStatus.cpp
Expand Up @@ -110,7 +110,7 @@ void VcsStatus::createPopupMenu()
));

_popupMenu->addItem(std::make_shared<wxutil::MenuItem>(
new wxMenuItem(nullptr, wxID_ANY, _("Sync Changes with Server"), ""),
new wxMenuItem(nullptr, wxID_ANY, _("Integrate Changes from Server"), ""),
[this]() { performSync(_repository); },
[this]() { return canSync(); }
));
Expand Down Expand Up @@ -206,8 +206,8 @@ void VcsStatus::onMapEvent(IMap::MapEvent ev)
}
else if (ev == IMap::MapMergeOperationFinished && _repository && _repository->mergeIsInProgress())
{
wxutil::Messagebox::Show(_("Save the map when done merging"),
_("Now that the merge is finished, please save the map such that the git merge operation can be completed."),
wxutil::Messagebox::Show(_("Save the File to complete the Merge"),
_("Now that the map is merged, please save the file\nsuch that the git operation can be completed."),
::ui::IDialog::MessageType::MESSAGE_CONFIRM);

// Now wait for the merge to complete (MapSaved event)
Expand Down

0 comments on commit dbe535e

Please sign in to comment.