1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2008 <jrliggett@cox.net>
6 * anjuta is free software.
8 * You may redistribute it and/or modify it under the terms of the
9 * GNU General Public License, as published by the Free Software
10 * Foundation; either version 2 of the License, or (at your option)
13 * anjuta is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with anjuta. If not, write to:
20 * The Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02110-1301, USA.
25 #include "git-tag-create-command.h"
27 struct _GitTagCreateCommandPriv
36 G_DEFINE_TYPE (GitTagCreateCommand
, git_tag_create_command
, GIT_TYPE_COMMAND
);
39 git_tag_create_command_init (GitTagCreateCommand
*self
)
41 self
->priv
= g_new0 (GitTagCreateCommandPriv
, 1);
45 git_tag_create_command_finalize (GObject
*object
)
47 GitTagCreateCommand
*self
;
49 self
= GIT_TAG_CREATE_COMMAND (object
);
51 g_free (self
->priv
->name
);
52 g_free (self
->priv
->revision
);
53 g_free (self
->priv
->log
);
56 G_OBJECT_CLASS (git_tag_create_command_parent_class
)->finalize (object
);
60 git_tag_create_command_run (AnjutaCommand
*command
)
62 GitTagCreateCommand
*self
;
64 self
= GIT_TAG_CREATE_COMMAND (command
);
66 git_command_add_arg (GIT_COMMAND (command
), "tag");
70 git_command_add_arg (GIT_COMMAND (command
), "-a");
71 git_command_add_arg (GIT_COMMAND (command
), "-m");
72 git_command_add_arg (GIT_COMMAND (command
), self
->priv
->log
);
76 git_command_add_arg (GIT_COMMAND (command
), "-s");
78 if (self
->priv
->force
)
79 git_command_add_arg (GIT_COMMAND (command
), "-f");
81 git_command_add_arg (GIT_COMMAND (command
), self
->priv
->name
);
83 if (self
->priv
->revision
)
84 git_command_add_arg (GIT_COMMAND (command
), self
->priv
->revision
);
90 git_tag_create_command_class_init (GitTagCreateCommandClass
*klass
)
92 GObjectClass
* object_class
= G_OBJECT_CLASS (klass
);
93 GitCommandClass
* parent_class
= GIT_COMMAND_CLASS (klass
);
94 AnjutaCommandClass
* command_class
= ANJUTA_COMMAND_CLASS (klass
);
96 object_class
->finalize
= git_tag_create_command_finalize
;
97 parent_class
->output_handler
= git_command_send_output_to_info
;
98 command_class
->run
= git_tag_create_command_run
;
102 GitTagCreateCommand
*
103 git_tag_create_command_new (const gchar
*working_directory
,
104 const gchar
*name
, const gchar
*revision
,
106 gboolean sign
, gboolean force
)
108 GitTagCreateCommand
*self
;
110 self
= g_object_new (GIT_TYPE_TAG_CREATE_COMMAND
,
111 "working-directory", working_directory
,
112 "single-line-output", TRUE
,
115 self
->priv
->name
= g_strdup (name
);
116 self
->priv
->revision
= g_strdup (revision
);
117 self
->priv
->log
= g_strdup (log
);
118 self
->priv
->sign
= sign
;
119 self
->priv
->force
= force
;
125 git_tag_create_command_get_tag_name (GitTagCreateCommand
*self
)
127 return g_strdup (self
->priv
->name
);