public
Rubygem
Description: Simple tool to help track git and svn vendor branches in a git repository
Homepage: http://evil.che.lu/projects/braid
Clone URL: git://github.com/evilchelu/braid.git
bail if local changes are present
evilchelu (author)
Wed Apr 30 07:24:47 -0700 2008
commit  20abc3f7f67a457c0afc2876b812f86a8fe6e261
tree    79f547ce4682259296ba99e87187618b7472fa77
parent  ff98eb3a363b07c17804deec8e90ba4bcfcd4d26
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ module Braid
0
   MIRROR_TYPES = %w[git svn]
0
   WORK_BRANCH = "braid/track"
0
   CONFIG_FILE = ".braids"
0
- REQUIRED_GIT_VERSION = "1.6.4.5"
0
+ REQUIRED_GIT_VERSION = "1.5.4.5"
0
 end
0
 
0
 require 'braid/version'
...
5
6
7
 
8
9
10
 
11
12
13
 
 
 
 
14
15
16
 
17
18
19
...
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
0
@@ -5,15 +5,22 @@ module Braid
0
 
0
     class << self
0
       include Operations::Helpers
0
+ include Operations::Git
0
 
0
       def run(command, *args)
0
         raise Braid::Git::VersionTooLow unless verify_git_version(REQUIRED_GIT_VERSION)
0
+ raise Braid::Git::LocalChangesPresent if local_changes?
0
 
0
         klass = Braid::Commands.const_get(command.to_s.capitalize)
0
         klass.new.run(*args)
0
+
0
+ rescue Braid::Git::LocalChangesPresent => e
0
+ msg "Local changes are present. You have to commit or stash them before running braid commands."
0
+
0
       rescue Braid::Git::VersionTooLow => e
0
         msg "This version of braid requires at least git #{REQUIRED_GIT_VERSION}. You have #{extract_git_version}."
0
         msg "Exiting."
0
+
0
       rescue => e
0
         # FIXME
0
       end
...
24
25
26
 
27
28
29
...
24
25
26
27
28
29
30
0
@@ -24,6 +24,7 @@ module Braid
0
   class Git
0
     class UnknownRevision < Braid::Exception; end
0
     class VersionTooLow < Braid::Exception; end
0
+ class LocalChangesPresent < Braid::Exception; end
0
   end
0
 
0
   class Svn
...
73
74
75
 
 
 
 
 
76
77
78
...
73
74
75
76
77
78
79
80
81
82
83
0
@@ -73,6 +73,11 @@ module Braid
0
         exec!("git rm -r #{path}")
0
         true
0
       end
0
+
0
+ def local_changes?
0
+ status, out, err = exec("git status")
0
+ out.split("\n").grep(/nothing to commit \(working directory clean\)/).empty?
0
+ end
0
     end
0
 
0
     module Svn

Comments

    No one has commented yet.