From 4bfa433d2cb881092d5e33283540f8853f4c6814 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 11 Apr 2014 13:09:45 +0300 Subject: [PATCH 1/8] - --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 936558a..178352f 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ repo, follow the instructions according to your operating system: Copy the two script files to `/usr/local/bin`. That's it. -### Windows (with Bash shell) ### +### Windows ### On Windows with Msysgit, you can copy them into `C:\Program Files (x86)\Git\bin`. Following caveats: - You will probably have to replace the shebang line with `#!c:\python34\python.exe` or wherever else you have Python 3 installed. - - You can only run these scripts from the ~Git Bash~. If you haven't installed Msysgit with `Git Bash Here` option, invoke `bin\bash.exe`. + - You can only run these scripts from the Git Bash. If you haven't installed Msysgit with `Git Bash Here` option, invoke `bin\bash.exe`. - You have to run `git-cascade` and `git-forward-merge` instead of `git cascade` and `git forward-merge` due to Windows shenanigans. From f1d0c40485cc377a50efff903fcd54c3ac8ff683 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sun, 13 Jul 2014 22:36:32 +0300 Subject: [PATCH 2/8] - --- git-cascade | 16 ++++++++++++---- git-forward-merge | 17 +++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/git-cascade b/git-cascade index a7b8aa7..7eca033 100755 --- a/git-cascade +++ b/git-cascade @@ -132,12 +132,14 @@ And then run: git cascade foo m It will cascade `foo` into `master` and all of its dependents. + +Also, you may use `.` as an alias for the current branch. ''' VersionInfo = collections.namedtuple('VersionInfo', 'major minor micro release') -__version__ = '0.1' -__version_info__ = VersionInfo(0, 0, 1, 'alpha') +__version__ = '0.2' +__version_info__ = VersionInfo(0, 2, 'alpha') def run(command, show=True, assert_success=True, env=None): popen = subprocess.Popen( @@ -199,10 +201,16 @@ alias_strings = [line[19:] for line in config_lines if aliases_dict = dict( alias_string.split('=', 1) for alias_string in alias_strings ) -expand_alias = lambda branch: aliases_dict.get(branch, branch) +def expand_branch_name(short_branch_name): + if short_branch_name == '.': + return current_branch + else: + return aliases_dict.get(short_branch_name, short_branch_name) # # ############################################################################### +current_branch = run('git rev-parse --abbrev-ref HEAD') + ### Organizing cascades: ###################################################### # # @@ -263,7 +271,7 @@ for cascade_string in cascade_strings: ### Analyzing input to get source and destinations: ########################### # # -branches = tuple(map(expand_alias, map(str.strip, sys.argv[1:]))) +branches = tuple(map(expand_branch_name, map(str.strip, sys.argv[1:]))) if not branches: show_help_and_exit() if len(branches) == 1: diff --git a/git-forward-merge b/git-forward-merge index ccd422c..2fec64b 100755 --- a/git-forward-merge +++ b/git-forward-merge @@ -78,12 +78,14 @@ And then run: git forward-merge s m It will merge `staging` into `master`. + +Also, you may use `.` as an alias for the current branch. ''' VersionInfo = collections.namedtuple('VersionInfo', 'major minor micro release') -__version__ = '0.1' -__version_info__ = VersionInfo(0, 0, 1, 'alpha') +__version__ = '0.2' +__version_info__ = VersionInfo(0, 2, 'alpha') @contextlib.contextmanager def create_temp_folder(): @@ -143,14 +145,19 @@ alias_strings = [line[19:] for line in config_lines if aliases_dict = dict( alias_string.split('=', 1) for alias_string in alias_strings ) -expand_alias = lambda branch: aliases_dict.get(branch, branch) +def expand_branch_name(short_branch_name): + if short_branch_name == '.': + return current_branch + else: + return aliases_dict.get(short_branch_name, short_branch_name) # # ############################################################################### +current_branch = run('git rev-parse --abbrev-ref HEAD') ### Analyzing input to get source and destinations: ########################### # # -branches = tuple(map(expand_alias, map(str.strip, sys.argv[1:]))) +branches = tuple(map(expand_branch_name, map(str.strip, sys.argv[1:]))) if not branches: show_help_and_exit() if len(branches) == 1: @@ -163,8 +170,6 @@ else: # # ### Finished analyzing input to get source and destinations. ################## -current_branch = run('git rev-parse --abbrev-ref HEAD') - print('Pushing %s' % (', '.join( (('%s -> %s' % (source, destination)) for destination in destinations)))) From 786a81abb8ef2a5a05e1adb4efc7d160f5141e49 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sun, 13 Jul 2014 22:37:04 +0300 Subject: [PATCH 3/8] - --- git-cascade | 2 +- git-forward-merge | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-cascade b/git-cascade index 7eca033..befbdd5 100755 --- a/git-cascade +++ b/git-cascade @@ -139,7 +139,7 @@ Also, you may use `.` as an alias for the current branch. VersionInfo = collections.namedtuple('VersionInfo', 'major minor micro release') __version__ = '0.2' -__version_info__ = VersionInfo(0, 2, 'alpha') +__version_info__ = VersionInfo(0, 2, 0, 'alpha') def run(command, show=True, assert_success=True, env=None): popen = subprocess.Popen( diff --git a/git-forward-merge b/git-forward-merge index 2fec64b..7ad5248 100755 --- a/git-forward-merge +++ b/git-forward-merge @@ -85,7 +85,7 @@ Also, you may use `.` as an alias for the current branch. VersionInfo = collections.namedtuple('VersionInfo', 'major minor micro release') __version__ = '0.2' -__version_info__ = VersionInfo(0, 2, 'alpha') +__version_info__ = VersionInfo(0, 2, 0, 'alpha') @contextlib.contextmanager def create_temp_folder(): From d6767bb1fd8da12b7ccc4c4817861dd49328e02c Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Mon, 15 Sep 2014 13:27:16 +0300 Subject: [PATCH 4/8] - --- git-cascade | 17 +++++++++++++---- git-forward-merge | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/git-cascade b/git-cascade index befbdd5..e5e855d 100755 --- a/git-cascade +++ b/git-cascade @@ -88,6 +88,14 @@ If only one argument is specified, git cascade will assume you want to cascade Will cascade `HEAD` into `staging` and all of its dependents. +If no arguments are specified: + + git cascade + +Then HEAD will be cascaded into the current branch. (It's often useful to +cascade a branch into itself because it also merges it into the branches it +flows into.) + How does it work? ----------------- @@ -138,8 +146,8 @@ Also, you may use `.` as an alias for the current branch. VersionInfo = collections.namedtuple('VersionInfo', 'major minor micro release') -__version__ = '0.2' -__version_info__ = VersionInfo(0, 2, 0, 'alpha') +__version__ = '0.3' +__version_info__ = VersionInfo(0, 3, 0, 'alpha') def run(command, show=True, assert_success=True, env=None): popen = subprocess.Popen( @@ -273,8 +281,9 @@ for cascade_string in cascade_strings: # # branches = tuple(map(expand_branch_name, map(str.strip, sys.argv[1:]))) if not branches: - show_help_and_exit() -if len(branches) == 1: + global_source = 'HEAD' + global_destinations = {current_branch} +elif len(branches) == 1: global_source = 'HEAD' global_destinations = {branches[0]} else: diff --git a/git-forward-merge b/git-forward-merge index 7ad5248..19f99c1 100755 --- a/git-forward-merge +++ b/git-forward-merge @@ -84,8 +84,8 @@ Also, you may use `.` as an alias for the current branch. VersionInfo = collections.namedtuple('VersionInfo', 'major minor micro release') -__version__ = '0.2' -__version_info__ = VersionInfo(0, 2, 0, 'alpha') +__version__ = '0.3' +__version_info__ = VersionInfo(0, 3, 0, 'alpha') @contextlib.contextmanager def create_temp_folder(): From e59970a49840a818c62feda3224905a42917eb6d Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Wed, 17 Sep 2014 15:10:11 +0300 Subject: [PATCH 5/8] - --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 178352f..ac9be47 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,14 @@ If only one argument is specified, git cascade will assume you want to cascade Will cascade `HEAD` into `staging` and all of its dependents. +If no arguments are specified: + + git cascade + +Then HEAD will be cascaded into the current branch. (It's often useful to +cascade a branch into itself because it also merges it into the branches it +flows into.) + How does it work? ----------------- From a4a98258aa2eaadc4a6375b08ffc21ae223da2fd Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Thu, 15 Jan 2015 18:45:58 +0200 Subject: [PATCH 6/8] - --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 178352f..ebd457d 100644 --- a/README.md +++ b/README.md @@ -239,4 +239,8 @@ Copyright and license ===================== Both scripts are copyright 2009-2014 Ram Rachum and are released under the MIT -license. +license. I provide +[freelance Django/Python development services](https://chipmunkdev.com). + + + From 0a8cebc6650df20ead93a677318946125af5c1c2 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 16 Jan 2015 23:30:51 +0200 Subject: [PATCH 7/8] - --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c1b750..c6a1278 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ Copyright and license Both scripts are copyright 2009-2014 Ram Rachum and are released under the MIT license. I provide -[freelance Django/Python development services](https://chipmunkdev.com). +[development services in Python and Django](https://chipmunkdev.com). From 5a6e8ef7d8fbf431c88c3bab2dd9a57f77862590 Mon Sep 17 00:00:00 2001 From: Marc Strapetz Date: Fri, 17 Apr 2015 15:09:13 +0200 Subject: [PATCH 8/8] README.md: trailing empty lines removed --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index c6a1278..b9306fe 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,3 @@ Copyright and license Both scripts are copyright 2009-2014 Ram Rachum and are released under the MIT license. I provide [development services in Python and Django](https://chipmunkdev.com). - - -