| ︙ | | |
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
-
+
|
wkspace);
if(wkspace.isEmpty() || !QDir(wkspace).exists())
return false;
}
// Ok open the repository file
if(!getWorkspace().createWorkspace(fi.absoluteFilePath(), wkspace))
if(!getWorkspace().create(fi.absoluteFilePath(), wkspace))
{
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
return false;
}
}
else
|
| ︙ | | |
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
-
+
-
+
-
+
|
if(!getWorkspace().createRepository(repo_abs_path))
{
QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok );
return;
}
if(!getWorkspace().createWorkspace(repo_abs_path, wkdir))
if(!getWorkspace().create(repo_abs_path, wkdir))
{
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
return;
}
// Disable unknown file filter
if(!ui->actionViewUnknown->isChecked())
ui->actionViewUnknown->setChecked(true);
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionCloseRepository_triggered()
{
if(getWorkspace().getWorkspaceState()!=Fossil::WORKSPACE_STATE_OK)
if(getWorkspace().getState()!=Fossil::WORKSPACE_STATE_OK)
return;
if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), tr("Are you sure you want to close this workspace?")))
return;
// Close Repo
if(!getWorkspace().closeWorkspace())
if(!getWorkspace().close())
{
QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes available?"), QMessageBox::Ok );
return;
}
stopUI();
setCurrentWorkspace("");
|
| ︙ | | |
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
-
+
|
//------------------------------------------------------------------------------
bool MainWindow::scanWorkspace()
{
setBusy(true);
bool valid = true;
// Load repository info
Fossil::WorkspaceState st = getWorkspace().getWorkspaceState();
Fossil::WorkspaceState st = getWorkspace().getState();
QString status;
if(st==Fossil::WORKSPACE_STATE_NOTFOUND)
{
status = tr("No workspace detected.");
valid = false;
}
|
| ︙ | | |
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
|
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
|
-
+
-
+
|
//------------------------------------------------------------------------------
void MainWindow::on_actionUndo_triggered()
{
// Gather Undo actions
QStringList res;
// Do test Undo
if(!getWorkspace().undoWorkspace(res, true))
if(!getWorkspace().undo(res, true))
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
if(res.length()>0 && res[0]=="No undo or redo is available")
return;
if(!FileActionDialog::run(this, tr("Undo"), tr("The following actions will be undone.")+"\n"+tr("Are you sure?"), res))
return;
// Do Undo
if(!getWorkspace().undoWorkspace(res, false))
if(!getWorkspace().undo(res, false))
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionAbout_triggered()
|
| ︙ | | |
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
|
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
|
-
+
-
+
|
return;
else if(selected_revision == latest)
selected_revision = ""; // Empty revision is "latest"
QStringList res;
// Do test update
if(!getWorkspace().updateWorkspace(res, selected_revision, true))
if(!getWorkspace().update(res, selected_revision, true))
{
QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok);
return;
}
if(res.length()==0)
return;
QStringMap kv;
ParseProperties(kv, res, ':');
// If no changes exit
if(kv.contains("changes") && kv["changes"].indexOf("None.")!=-1)
return;
if(!FileActionDialog::run(this, tr("Update"), tr("The following files will be updated.")+"\n"+tr("Are you sure?"), res))
return;
// Do update
if(!getWorkspace().updateWorkspace(res, selected_revision, false))
if(!getWorkspace().update(res, selected_revision, false))
QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok);
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionCreateTag_triggered()
|
| ︙ | | |
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
|
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
|
-
+
-
+
-
+
-
+
|
QUrl url(remotes.first());
// Retrieve password from keychain
if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore());
if(!getWorkspace().pushWorkspace(url))
if(!getWorkspace().push(url))
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
}
//------------------------------------------------------------------------------
void MainWindow::on_actionPullRemote_triggered()
{
QStringList remotes;
getSelectionRemotes(remotes);
if(remotes.empty())
return;
QUrl url(remotes.first());
// Retrieve password from keychain
if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore());
if(!getWorkspace().pullWorkspace(url))
if(!getWorkspace().pull(url))
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
}
//------------------------------------------------------------------------------
void MainWindow::on_actionPush_triggered()
{
QUrl url = getWorkspace().getRemoteDefault();
if(url.isEmpty())
{
QMessageBox::critical(this, tr("Error"), tr("A default remote repository has not been specified."), QMessageBox::Ok);
return;
}
// Retrieve password from keychain
if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore());
if(!getWorkspace().pushWorkspace(url))
if(!getWorkspace().push(url))
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
}
//------------------------------------------------------------------------------
void MainWindow::on_actionPull_triggered()
{
QUrl url = getWorkspace().getRemoteDefault();
if(url.isEmpty())
{
QMessageBox::critical(this, tr("Error"), tr("A default remote repository has not been specified."), QMessageBox::Ok);
return;
}
// Retrieve password from keychain
if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore());
if(!getWorkspace().pullWorkspace(url))
if(!getWorkspace().pull(url))
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
}
//------------------------------------------------------------------------------
void MainWindow::on_actionSetDefaultRemote_triggered()
{
QStringList remotes;
|
| ︙ | | |
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
|
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
|
-
+
|
KeychainGet(this, url, *settings.GetStore());
// FIXME: Fossil currently ignores the password in "remote-url"
// which breaks commits due to a missing password when autosync is enabled
// so only set the remote url when there is no password set
if(url.password().isEmpty())
{
if(!getWorkspace().setDefaultRemoteUrl(url))
if(!getWorkspace().fossil().setRemoteUrl(url))
QMessageBox::critical(this, tr("Error"), tr("Could not set the remote repository."), QMessageBox::Ok);
}
}
updateWorkspaceView();
}
|
| ︙ | | |