Commit 6616c3b0 authored by Claes Sjofors's avatar Claes Sjofors

wb revisions, Git set as default, and 'Enable revisions' added in settings

parent b9d0d49d
......@@ -55,6 +55,7 @@
# define pwr_cNameDistribute "$pwrp_root/src/db/pwrp_cnf_distribute.dat"
# define pwr_cNameSysObject "$pwrp_root/src/db/pwrp_cnf_sysobject.dat"
# define pwr_cNameFilePath "$pwrp_root/src/db/pwrp_cnf_dirlist.dat"
# define pwr_cNameRevision "$pwrp_root/src/db/pwrp_cnf_revision.dat"
# define pwr_cNameLocalWb "$pwrp_root/src/db/wb.wb_load"
# define pwr_cNameGblVolumeList "$pwra_db/pwr_volumelist.dat"
# define pwr_cNameCmnVolumeList "pwr_volumelist.dat"
......
......@@ -48,3 +48,5 @@ noselect <No revision is selected> /error
createpos <Unable to create a new revision from current> /error
nosuchrev <No such revision> /error
nobranch <No branch is checked out> /info
nochange <No change since last revision> /error
nogit <Git not found> /error
\ No newline at end of file
......@@ -54,7 +54,6 @@ pwrc_dblist_read()
pwrc_status=$pwrc__success
#set -o xtrace
echo "arg1: \"$1\" arg2: \"$2\" arg3: \"$3\""
if [ -n "${db_array[*]}" ]; then
unset db_array
......
......@@ -1905,6 +1905,7 @@ void WttGtk::boot_ok_cb(GtkWidget *w, gpointer data)
GtkTreeIter iter;
GtkTreeModel *store;
char *text;
int node_type;
if ( !wtt->focused_wnav)
wtt->set_focus_default();
......@@ -1929,9 +1930,10 @@ void WttGtk::boot_ok_cb(GtkWidget *w, gpointer data)
strcpy( nodeconfigname, volumelist_ptr->p1);
if ( strcmp( nodeconfigname, text) == 0) {
node_type = atoi( volumelist_ptr->p6);
wb_build build( *(wb_session *)wtt->ldhses, wtt->focused_wnav);
build.opt = wtt->focused_wnav->gbl.build;
build.node( nodeconfigname,
build.node( nodeconfigname, node_type,
wtt->boot_volumelist, wtt->boot_volumecount);
if ( build.evenSts()) {
gtk_widget_destroy( ((WttGtk *)wtt)->boot_dia);
......@@ -1970,6 +1972,7 @@ void WttGtk::update_options_form()
{
// Hierarchies
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enable_comment_w), enable_comment ? TRUE : FALSE);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enable_revisions_w), enable_revisions ? TRUE : FALSE);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(show_plant_w), wnav_mapped ? TRUE : FALSE);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(show_node_w), wnavnode_mapped ? TRUE : FALSE);
......@@ -2000,6 +2003,7 @@ void WttGtk::update_options_form()
void WttGtk::set_options()
{
enable_comment = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enable_comment_w));
enable_revisions = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enable_revisions_w));
show_class = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(show_class_w));
show_alias = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(show_alias_w));
show_descrip = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(show_descrip_w));
......@@ -2013,14 +2017,13 @@ void WttGtk::set_options()
build_crossref_sim = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_crossrefsim_w));
build_crossref_graph = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_crossrefgraph_w));
build_manual = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_manual_w));
build_nocopy = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(build_nocopy_w));
wnav->set_options( enable_comment, show_class, show_alias,
wnav->set_options( enable_comment, enable_revisions, show_class, show_alias,
show_descrip, show_objref, show_objxref,
show_attrref, show_attrxref, build_force, build_debug,
build_crossref, build_crossref_sim, build_crossref_graph,
build_manual, build_nocopy);
wnavnode->set_options( enable_comment, show_class, show_alias,
wnavnode->set_options( enable_comment, enable_revisions, show_class, show_alias,
show_descrip, show_objref, show_objxref,
show_attrref, show_attrxref, build_force, build_debug,
build_crossref, build_crossref_sim, build_crossref_graph,
......@@ -2115,10 +2118,11 @@ WttGtk::WttGtk(
pwr_tFileName fname;
wb_rev_info rev_info;
char version[80];
pwr_tStatus revsts;
wb_revision::info( &rev_info);
if ( !rev_info.in_master)
revsts = wb_revision::info( &rev_info);
if ( ODD(revsts) && !rev_info.in_master)
strcpy( version, rev_info.name);
else
strcpy( version, "");
......@@ -3087,7 +3091,7 @@ WttGtk::WttGtk(
g_object_set( cmd_input, "visible", FALSE, NULL);
gtk_paned_set_position( GTK_PANED(wnav_paned), window_width / 2);
wnav->get_options( &enable_comment, &show_class, &show_alias,
wnav->get_options( &enable_comment, &enable_revisions, &show_class, &show_alias,
&show_descrip, &show_objref, &show_objxref,
&show_attrref, &show_attrxref, &build_force, &build_debug,
&build_crossref, &build_crossref_sim, &build_crossref_graph,
......@@ -3122,7 +3126,7 @@ WttGtk::WttGtk(
menu_setup();
update_title();
if ( !rev_info.in_end_of_branch) {
if ( ODD(revsts) && !rev_info.in_end_of_branch) {
wnav->wow->DisplayError( "Revision", "Revision is not at end o branch.\nNo changes can be made.");
CoLogin::reduce_privilege( pwr_mPrv_DevConfig | pwr_mPrv_DevPlc | pwr_mPrv_DevClass);
}
......@@ -3192,12 +3196,14 @@ void WttGtk::create_options_dialog()
GtkWidget *hier_label = gtk_label_new( "Hierarchy");
enable_comment_w = gtk_check_button_new_with_label( "Enable Comment");
enable_revisions_w = gtk_check_button_new_with_label( "Enable Revisions");
show_plant_w = gtk_check_button_new_with_label( "Plant Configuration");
show_node_w = gtk_check_button_new_with_label( "Node Configuration");
GtkWidget *hier_vbox = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(hier_vbox), hier_label, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(hier_vbox), enable_comment_w, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(hier_vbox), enable_revisions_w, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(hier_vbox), show_plant_w, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(hier_vbox), show_node_w, FALSE, FALSE, 7);
......
......@@ -102,6 +102,7 @@ class WttGtk : public Wtt {
GtkWidget *build_crossrefgraph_w;
GtkWidget *build_manual_w;
GtkWidget *build_nocopy_w;
GtkWidget *enable_revisions_w;
GtkWidget *menu_save_w;
GtkWidget *menu_revert_w;
GtkWidget *menu_cut_w;
......
This diff is collapsed.
......@@ -76,9 +76,12 @@ class wb_version_manager
{
private:
pwr_eVersionManagerEnum m_manager;
protected:
pwr_tStatus m_sts;
public:
wb_version_manager( pwr_eVersionManagerEnum manager) : m_manager(manager) {}
wb_version_manager( pwr_eVersionManagerEnum manager) : m_manager(manager), m_sts(0) {}
pwr_tStatus sts() { return m_sts;}
virtual ~wb_version_manager() {}
virtual void init() {}
virtual int store_revision( char *name, char *descr, bool new_branch) { return 0;}
......@@ -86,10 +89,16 @@ class wb_version_manager
virtual int get_current( char *name) { return 0;}
virtual int check( vector<wb_rev_item>& v) { return 0;}
virtual int check_add( char *filename) { return 0;}
virtual bool modified() { return true;}
};
class wb_version_manager_git : public wb_version_manager
{
static bool m_found;
static bool m_found_tested;
bool git_found();
public:
wb_version_manager_git() : wb_version_manager(pwr_eVersionManagerEnum_None) { init();}
~wb_version_manager_git() {}
......@@ -101,6 +110,7 @@ class wb_version_manager_git : public wb_version_manager
int get_current( char *name);
int check( vector<wb_rev_item>& v);
int check_add( char *filename);
bool modified();
};
class wb_revision : public wb_status
......@@ -115,6 +125,7 @@ class wb_revision : public wb_status
int m_current_idx;
int m_current_main_idx;
int m_current_sub_idx;
int m_next_idx;
int (*m_command_cb)( void *ctx, char *cmd);
public:
......@@ -129,6 +140,8 @@ class wb_revision : public wb_status
pwr_tStatus restore( char *name);
pwr_tStatus build_all();
pwr_tStatus remove( char *name);
bool set_current( char *name);
bool set_current( int idx);
void read_file();
void read_file_meta();
void write_file();
......@@ -146,7 +159,7 @@ class wb_revision : public wb_status
void next_name( char *name);
static char *branch_name( char *name);
static void info( wb_rev_info *info);
static pwr_tStatus info( wb_rev_info *info);
static int check_add_file( char *filename);
};
......
......@@ -2271,6 +2271,9 @@ int WNav::setup()
new WItemLocal( this, "EnableComment", "setup_comment",
pwr_eType_Int32, sizeof( gbl.enable_comment), 0, 1,
(void *) &gbl.enable_comment, NULL, flow_eDest_IntoLast);
new WItemLocal( this, "EnableRevisions", "setup_revisions",
pwr_eType_Int32, sizeof( gbl.enable_revisions), 0, 1,
(void *) &gbl.enable_revisions, NULL, flow_eDest_IntoLast);
new WItemLocal( this, "AdvancedUser", "setup_advanceduser",
pwr_eType_Int32, sizeof( gbl.advanced_user), 0, 1,
(void *) &gbl.advanced_user, NULL, flow_eDest_IntoLast);
......@@ -2351,12 +2354,13 @@ int WNavGbl::symbolfile_exec( void *wnav)
return WNAV__SUCCESS;
}
void WNav::set_options( int ena_comment, int sh_class, int sh_alias, int sh_descrip,
void WNav::set_options( int ena_comment, int ena_revisions, int sh_class, int sh_alias, int sh_descrip,
int sh_objref, int sh_objxref, int sh_attrref, int sh_attrxref,
int bu_force, int bu_debug, int bu_crossref, int bu_crossrefsim,
int bu_crossrefgraph, int bu_manual, int bu_nocopy)
{
gbl.enable_comment = ena_comment;
gbl.enable_revisions = ena_revisions;
gbl.show_class = sh_class;
gbl.show_alias = sh_alias;
gbl.show_descrip = sh_descrip;
......@@ -2374,12 +2378,13 @@ void WNav::set_options( int ena_comment, int sh_class, int sh_alias, int sh_desc
ldh_refresh( pwr_cNObjid);
}
void WNav::get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_descrip,
void WNav::get_options( int *ena_comment, int *ena_revisions, int *sh_class, int *sh_alias, int *sh_descrip,
int *sh_objref, int *sh_objxref, int *sh_attrref, int *sh_attrxref,
int *bu_force, int *bu_debug, int *bu_crossref, int *bu_crossrefsim,
int *bu_crossrefgraph, int *bu_manual, int *bu_nocopy)
{
*ena_comment = gbl.enable_comment;
*ena_revisions = gbl.enable_revisions;
*sh_class = gbl.show_class;
*sh_alias = gbl.show_alias;
*sh_descrip = gbl.show_descrip;
......@@ -2486,6 +2491,11 @@ int WNav::save_settnings( ofstream& fp)
else
fp << " set nobuildnocopy /local" << endl;
if ( gbl.enable_revisions)
fp << " set enablerevisions /local" << endl;
else
fp << " set noenablerevisions /local" << endl;
if ( window_type == wnav_eWindowType_W1)
fp << "endif" << endl;
else if ( window_type == wnav_eWindowType_W2)
......
......@@ -202,7 +202,7 @@ class WNavGbl {
priv(0), verify(0), advanced_user(1), all_toplevel(0), bypass(0),
show_class(1), show_alias(0), show_descrip(1), show_attrref(0),
show_attrxref(0), show_objref(0), show_objxref(0), show_truedb(0),
enable_comment(0)
enable_comment(0), enable_revisions(0)
{
strcpy( version, wnav_cVersion);
strcpy( platform, ""); strcpy( os, ""); strcpy( hw, "");
......@@ -231,6 +231,7 @@ class WNavGbl {
int show_objxref;
int show_truedb;
int enable_comment;
int enable_revisions;
wb_build_opt build;
int load_config( void *wnav);
......@@ -412,11 +413,11 @@ class WNav : public WUtility{
void ldh_refresh( pwr_tObjid new_open);
void refresh();
void collapse();
void set_options( int ena_comment, int sh_class, int sh_alias, int sh_descrip,
void set_options( int ena_comment, int ena_revisions, int sh_class, int sh_alias, int sh_descrip,
int sh_objref, int sh_objxref, int sh_attrref, int sh_attrxref,
int bu_force, int bu_debug, int bu_crossref, int bu_crossrefsim,
int bu_crossrefgraph, int bu_manual, int bu_nocopy);
void get_options( int *ena_comment, int *sh_class, int *sh_alias, int *sh_descrip,
void get_options( int *ena_comment, int *ena_revisions, int *sh_class, int *sh_alias, int *sh_descrip,
int *sh_objref, int *sh_objxref, int *sh_attrref, int *sh_attrxref,
int *bu_force, int *bu_debug, int *bu_crossref, int *bu_crossrefsim,
int *bu_crossrefgraph, int *bu_manual, int *bu_nocopy);
......
......@@ -1398,6 +1398,20 @@ static int wnav_set_func( void *client_data,
else
wnav->gbl.enable_comment = 0;
}
else if ( cdh_NoCaseStrncmp( arg1_str, "ENABLEREVISIONS", strlen( arg1_str)) == 0)
{
if ( EVEN( dcli_get_qualifier( "/LOCAL", 0, 0)))
(wnav->gbl_command_cb)( wnav->parent_ctx, "SET ENABLEREVISIONS");
else
wnav->gbl.enable_revisions = 1;
}
else if ( cdh_NoCaseStrncmp( arg1_str, "NOENABLEREVISIONS", strlen( arg1_str)) == 0)
{
if ( EVEN( dcli_get_qualifier( "/LOCAL", 0, 0)))
(wnav->gbl_command_cb)( wnav->parent_ctx, "SET NOENABLEREVISIONS");
else
wnav->gbl.enable_revisions = 0;
}
else if ( cdh_NoCaseStrncmp( arg1_str, "VERIFY", strlen( arg1_str)) == 0)
{
if ( wnav->window_type == wnav_eWindowType_No)
......@@ -5272,6 +5286,9 @@ static int wnav_build_func( void *client_data,
char namestr[80];
void *volumelist;
int volumecount;
lfu_t_volumelist *vp;
int found;
int node_type;
if ( EVEN( dcli_get_qualifier( "/NAME", namestr, sizeof(namestr)))) {
if ( EVEN( dcli_get_qualifier( "dcli_arg2", namestr, sizeof(namestr)))) {
......@@ -5288,13 +5305,29 @@ static int wnav_build_func( void *client_data,
return sts;
}
found = 0;
vp = (lfu_t_volumelist *)volumelist;
for ( int i = 0; i < volumecount; i++) {
if ( cdh_NoCaseStrcmp( vp[i].p1, namestr) == 0) {
found = 1;
node_type = atoi( vp[i].p6);
break;
}
}
if ( !found) {
wnav->message( 'E', "No such node");
return WNAV__SYNTAX;
}
wb_build build( *(wb_session *)wnav->ldhses, wnav);
build.opt.force = ODD( dcli_get_qualifier( "/FORCE", 0, 0));
build.opt.debug = ODD( dcli_get_qualifier( "/DEBUG", 0, 0));
build.opt.crossref = ODD( dcli_get_qualifier( "/CROSSREFERENCE", 0, 0));
build.opt.manual = ODD( dcli_get_qualifier( "/MANUAL", 0, 0));
build.node( namestr, volumelist, volumecount);
build.node( vp->p1, node_type, volumelist, volumecount);
wnav->message(' ', wnav_get_message(build.sts()));
command_sts = build.sts();
......
......@@ -85,6 +85,16 @@ void WRev::store_ok_cb( WRev *wrev, char *text1, char *text2)
{
pwr_tStatus sts;
if ( strcmp( text1, "") == 0 ) {
wrev->wow->DisplayError( "Syntax Error", "Revision name is missing");
return;
}
if ( strcmp( text2, "") == 0 ) {
wrev->wow->DisplayError( "Syntax Error", "Description is missing");
return;
}
wrev->set_clock_cursor();
sts = wrev->wrevnav->rev->create( 1, text1, text2);
......@@ -104,7 +114,7 @@ void WRev::activate_store()
// Check if new revision is allowed
sts = wrevnav->rev->create_check();
if ( EVEN(sts)) {
wow->DisplayError( "New Revision Error", "New revksion can't be created\nCurrent revision is not at end of branch");
wow->DisplayError( "New Revision Error", "New revision can't be created\nCurrent revision is not at end of branch");
return;
}
......
......@@ -1004,7 +1004,15 @@ void Wtt::activate_revert()
void Wtt::activate_revisions()
{
wnavnode->command( (char *)"open revisions");
if ( !focused_wnav)
set_focus_default();
if ( !focused_wnav->gbl.enable_revisions) {
focused_wnav->wow->DisplayError( "Revisions",
"Revision is not enabled.\nEnable revisions in Tools/Settings.");
return;
}
focused_wnav->command( (char *)"open revisions");
}
void Wtt::activate_syntax()
......@@ -2012,6 +2020,7 @@ void Wtt::activate_buildnode()
{
pwr_tStatus sts;
lfu_t_volumelist *vp, *volp;
int node_type;
message(' ',"");
......@@ -2052,9 +2061,10 @@ void Wtt::activate_buildnode()
if ( !focused_wnav)
set_focus_default();
build->opt = focused_wnav->gbl.build;
node_type = atoi(vp->p6);
set_clock_cursor();
build->node( volp->p1, boot_volumelist, boot_volumecount);
build->node( volp->p1, node_type, boot_volumelist, boot_volumecount);
reset_cursor();
if ( build->evenSts()) {
char msg[80];
......
......@@ -190,6 +190,7 @@ class Wtt : public WUtility {
int build_crossref_graph;
int build_manual;
int build_nocopy;
int enable_revisions;
int wnav_mapped;
int wnavnode_mapped;
WUted *utedctx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment