~ubuntu-branches/ubuntu/natty/quickly/natty

« back to all changes in this revision

Viewing changes to data/templates/ubuntu-project/save.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-07-24 18:16:30 UTC
  • Revision ID: james.westby@ubuntu.com-20090724181630-s2wo7hvahk8u0hqb
Tags: 0.1
Initial release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# Copyright 2009 Canonical Ltd.
 
3
# Author 2009 Didier Roche
 
4
#
 
5
# This file is part of Quickly ubuntu-project-template
 
6
#
 
7
#This program is free software: you can redistribute it and/or modify it 
 
8
#under the terms of the GNU General Public License version 3, as published 
 
9
#by the Free Software Foundation.
 
10
 
 
11
#This program is distributed in the hope that it will be useful, but 
 
12
#WITHOUT ANY WARRANTY; without even the implied warranties of 
 
13
#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
 
14
#PURPOSE.  See the GNU General Public License for more details.
 
15
 
 
16
#You should have received a copy of the GNU General Public License along 
 
17
#with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
"""
 
19
Usage:
 
20
$quickly save notes about changes
 
21
where "notes about changes" is optional text describing what changes
 
22
were made since the last save.
 
23
 
 
24
This command commits all changes since the last save to bzr. Note that 
 
25
it does not push changes to any back up location. If you need revert
 
26
or otherwise use the revision control, us bzr directly:
 
27
$bzr help
 
28
 
 
29
"""
 
30
import sys
 
31
import subprocess
 
32
 
 
33
import gettext
 
34
from gettext import gettext as _
 
35
gettext.textdomain('quickly')
 
36
 
 
37
#set either a default message or the specified message
 
38
commit_msg = " ".join(sys.argv[1:])
 
39
if commit_msg == "":
 
40
   commit_msg = _('quickly saved')
 
41
 
 
42
#save away
 
43
subprocess.call(["bzr", "add"])
 
44
return_code = subprocess.call(["bzr", "commit", "-m" + commit_msg])
 
45
if return_code == 3:
 
46
    print _("It seems that you have no change to record.")
 
47
 
 
48
sys.exit(return_code)
 
49