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-push-command.h"
27 struct _GitPushCommandPriv
36 G_DEFINE_TYPE (GitPushCommand
, git_push_command
, GIT_TYPE_COMMAND
);
39 git_push_command_init (GitPushCommand
*self
)
41 self
->priv
= g_new0 (GitPushCommandPriv
, 1);
42 git_command_set_check_passwd_prompt (GIT_COMMAND (self
), TRUE
);
46 git_push_command_finalize (GObject
*object
)
50 self
= GIT_PUSH_COMMAND (object
);
52 g_free (self
->priv
->url
);
53 anjuta_util_glist_strings_free (self
->priv
->refs
);
56 G_OBJECT_CLASS (git_push_command_parent_class
)->finalize (object
);
60 git_push_command_run (AnjutaCommand
*command
)
64 self
= GIT_PUSH_COMMAND (command
);
66 git_command_add_arg (GIT_COMMAND (command
), "push");
68 if (self
->priv
->push_all
)
69 git_command_add_arg (GIT_COMMAND (command
), "--all");
71 if (self
->priv
->push_tags
)
72 git_command_add_arg (GIT_COMMAND (command
), "--tags");
74 if (self
->priv
->force
)
75 git_command_add_arg (GIT_COMMAND (command
), "--force");
77 git_command_add_arg (GIT_COMMAND (command
), self
->priv
->url
);
80 git_command_add_list_to_args (GIT_COMMAND (command
), self
->priv
->refs
);
86 git_push_command_class_init (GitPushCommandClass
*klass
)
88 GObjectClass
* object_class
= G_OBJECT_CLASS (klass
);
89 GitCommandClass
* parent_class
= GIT_COMMAND_CLASS (klass
);
90 AnjutaCommandClass
* command_class
= ANJUTA_COMMAND_CLASS (klass
);
92 object_class
->finalize
= git_push_command_finalize
;
93 parent_class
->output_handler
= git_command_send_output_to_info
;
94 command_class
->run
= git_push_command_run
;
99 git_push_command_new (const gchar
*working_directory
,
106 GitPushCommand
*self
;
108 self
= g_object_new (GIT_TYPE_PUSH_COMMAND
,
109 "working-directory", working_directory
,
110 "single-line-output", TRUE
,
113 self
->priv
->url
= g_strdup (url
);
114 self
->priv
->refs
= git_command_copy_string_list (refs
);
115 self
->priv
->push_all
= push_all
;
116 self
->priv
->push_tags
= push_tags
;
117 self
->priv
->force
= force
;