Merge pull request #3803 from jbrazio/feature/buildroot-cleanup
Buildroot cleanup
This commit is contained in:
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
""" Generate the stepper delay lookup table for Marlin firmware. """
|
||||
|
||||
import argparse
|
||||
|
||||
__author__ = "Ben Gamari <bgamari@gmail.com>"
|
||||
__copyright__ = "Copyright 2012, Ben Gamari"
|
||||
__license__ = "GPL"
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('-f', '--cpu-freq', type=int, default=16, help='CPU clockrate in MHz (default=16)')
|
||||
parser.add_argument('-d', '--divider', type=int, default=8, help='Timer/counter pre-scale divider (default=8)')
|
||||
args = parser.parse_args()
|
||||
|
||||
cpu_freq = args.cpu_freq * 1000000
|
||||
timer_freq = cpu_freq / args.divider
|
||||
|
||||
print "#ifndef SPEED_LOOKUPTABLE_H"
|
||||
print "#define SPEED_LOOKUPTABLE_H"
|
||||
print
|
||||
print '#include "Marlin.h"'
|
||||
print
|
||||
|
||||
print "const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {"
|
||||
a = [ timer_freq / ((i*256)+(args.cpu_freq*2)) for i in range(256) ]
|
||||
b = [ a[i] - a[i+1] for i in range(255) ]
|
||||
b.append(b[-1])
|
||||
for i in range(32):
|
||||
print " ",
|
||||
for j in range(8):
|
||||
print "{%d, %d}," % (a[8*i+j], b[8*i+j]),
|
||||
print
|
||||
print "};"
|
||||
print
|
||||
|
||||
print "const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {"
|
||||
a = [ timer_freq / ((i*8)+(args.cpu_freq*2)) for i in range(256) ]
|
||||
b = [ a[i] - a[i+1] for i in range(255) ]
|
||||
b.append(b[-1])
|
||||
for i in range(32):
|
||||
print " ",
|
||||
for j in range(8):
|
||||
print "{%d, %d}," % (a[8*i+j], b[8*i+j]),
|
||||
print
|
||||
print "};"
|
||||
print
|
||||
|
||||
print "#endif"
|
||||
|
@ -1,156 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
"""Thermistor Value Lookup Table Generator
|
||||
|
||||
Generates lookup to temperature values for use in a microcontroller in C format based on:
|
||||
http://en.wikipedia.org/wiki/Steinhart-Hart_equation
|
||||
|
||||
The main use is for Arduino programs that read data from the circuit board described here:
|
||||
http://make.rrrf.org/ts-1.0
|
||||
|
||||
Usage: python createTemperatureLookup.py [options]
|
||||
|
||||
Options:
|
||||
-h, --help show this help
|
||||
--rp=... pull-up resistor
|
||||
--t1=ttt:rrr low temperature temperature:resistance point (around 25 degC)
|
||||
--t2=ttt:rrr middle temperature temperature:resistance point (around 150 degC)
|
||||
--t3=ttt:rrr high temperature temperature:resistance point (around 250 degC)
|
||||
--num-temps=... the number of temperature points to calculate (default: 36)
|
||||
"""
|
||||
|
||||
from math import *
|
||||
import sys
|
||||
import getopt
|
||||
|
||||
"Constants"
|
||||
ZERO = 273.15 # zero point of Kelvin scale
|
||||
VADC = 5 # ADC voltage
|
||||
VCC = 5 # supply voltage
|
||||
ARES = pow(2,10) # 10 Bit ADC resolution
|
||||
VSTEP = VADC / ARES # ADC voltage resolution
|
||||
TMIN = 0 # lowest temperature in table
|
||||
TMAX = 350 # highest temperature in table
|
||||
|
||||
class Thermistor:
|
||||
"Class to do the thermistor maths"
|
||||
def __init__(self, rp, t1, r1, t2, r2, t3, r3):
|
||||
l1 = log(r1)
|
||||
l2 = log(r2)
|
||||
l3 = log(r3)
|
||||
y1 = 1.0 / (t1 + ZERO) # adjust scale
|
||||
y2 = 1.0 / (t2 + ZERO)
|
||||
y3 = 1.0 / (t3 + ZERO)
|
||||
x = (y2 - y1) / (l2 - l1)
|
||||
y = (y3 - y1) / (l3 - l1)
|
||||
c = (y - x) / ((l3 - l2) * (l1 + l2 + l3))
|
||||
b = x - c * (l1**2 + l2**2 + l1*l2)
|
||||
a = y1 - (b + l1**2 *c)*l1
|
||||
|
||||
if c < 0:
|
||||
print "//////////////////////////////////////////////////////////////////////////////////////"
|
||||
print "// WARNING: negative coefficient 'c'! Something may be wrong with the measurements! //"
|
||||
print "//////////////////////////////////////////////////////////////////////////////////////"
|
||||
c = -c
|
||||
self.c1 = a # Steinhart-Hart coefficients
|
||||
self.c2 = b
|
||||
self.c3 = c
|
||||
self.rp = rp # pull-up resistance
|
||||
|
||||
def resol(self, adc):
|
||||
"Convert ADC reading into a resolution"
|
||||
res = self.temp(adc)-self.temp(adc+1)
|
||||
return res
|
||||
|
||||
def voltage(self, adc):
|
||||
"Convert ADC reading into a Voltage"
|
||||
return adc * VSTEP # convert the 10 bit ADC value to a voltage
|
||||
|
||||
def resist(self, adc):
|
||||
"Convert ADC reading into a resistance in Ohms"
|
||||
r = self.rp * self.voltage(adc) / (VCC - self.voltage(adc)) # resistance of thermistor
|
||||
return r
|
||||
|
||||
def temp(self, adc):
|
||||
"Convert ADC reading into a temperature in Celcius"
|
||||
l = log(self.resist(adc))
|
||||
Tinv = self.c1 + self.c2*l + self.c3* l**3 # inverse temperature
|
||||
return (1/Tinv) - ZERO # temperature
|
||||
|
||||
def adc(self, temp):
|
||||
"Convert temperature into a ADC reading"
|
||||
x = (self.c1 - (1.0 / (temp+ZERO))) / (2*self.c3)
|
||||
y = sqrt((self.c2 / (3*self.c3))**3 + x**2)
|
||||
r = exp((y-x)**(1.0/3) - (y+x)**(1.0/3))
|
||||
return (r / (self.rp + r)) * ARES
|
||||
|
||||
def main(argv):
|
||||
"Default values"
|
||||
t1 = 25 # low temperature in Kelvin (25 degC)
|
||||
r1 = 100000 # resistance at low temperature (10 kOhm)
|
||||
t2 = 150 # middle temperature in Kelvin (150 degC)
|
||||
r2 = 1641.9 # resistance at middle temperature (1.6 KOhm)
|
||||
t3 = 250 # high temperature in Kelvin (250 degC)
|
||||
r3 = 226.15 # resistance at high temperature (226.15 Ohm)
|
||||
rp = 4700; # pull-up resistor (4.7 kOhm)
|
||||
num_temps = 36; # number of entries for look-up table
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
|
||||
except getopt.GetoptError as err:
|
||||
print str(err)
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt in ("-h", "--help"):
|
||||
usage()
|
||||
sys.exit()
|
||||
elif opt == "--rp":
|
||||
rp = int(arg)
|
||||
elif opt == "--t1":
|
||||
arg = arg.split(':')
|
||||
t1 = float(arg[0])
|
||||
r1 = float(arg[1])
|
||||
elif opt == "--t2":
|
||||
arg = arg.split(':')
|
||||
t2 = float(arg[0])
|
||||
r2 = float(arg[1])
|
||||
elif opt == "--t3":
|
||||
arg = arg.split(':')
|
||||
t3 = float(arg[0])
|
||||
r3 = float(arg[1])
|
||||
elif opt == "--num-temps":
|
||||
num_temps = int(arg)
|
||||
|
||||
t = Thermistor(rp, t1, r1, t2, r2, t3, r3)
|
||||
increment = int((ARES-1)/(num_temps-1));
|
||||
step = (TMIN-TMAX) / (num_temps-1)
|
||||
low_bound = t.temp(ARES-1);
|
||||
up_bound = t.temp(1);
|
||||
min_temp = int(TMIN if TMIN > low_bound else low_bound)
|
||||
max_temp = int(TMAX if TMAX < up_bound else up_bound)
|
||||
temps = range(max_temp, TMIN+step, step);
|
||||
|
||||
print "// Thermistor lookup table for Marlin"
|
||||
print "// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s" % (rp, t1, r1, t2, r2, t3, r3, num_temps)
|
||||
print "// Steinhart-Hart Coefficients: a=%.15g, b=%.15g, c=%.15g " % (t.c1, t.c2, t.c3)
|
||||
print "// Theoretical limits of termistor: %.2f to %.2f degC" % (low_bound, up_bound)
|
||||
print
|
||||
print "#define NUMTEMPS %s" % (len(temps))
|
||||
print "const short temptable[NUMTEMPS][2] PROGMEM = {"
|
||||
|
||||
for temp in temps:
|
||||
adc = t.adc(temp)
|
||||
print " { (short) (%7.2f * OVERSAMPLENR ), %4s }%s // v=%.3f\tr=%.3f\tres=%.3f degC/count" % (adc , temp, \
|
||||
',' if temp != temps[-1] else ' ', \
|
||||
t.voltage(adc), \
|
||||
t.resist( adc), \
|
||||
t.resol( adc) \
|
||||
)
|
||||
print "};"
|
||||
|
||||
def usage():
|
||||
print __doc__
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
IGNORE_DEFINES="LANGUAGE_EN_H MAPPER_NON SIMULATE_ROMFONT DISPLAY_CHARSET_ISO10646_1 MSG_H1 MSG_H2 MSG_H3 MSG_H4 MSG_MOVE_E1 MSG_MOVE_E2 MSG_MOVE_E3 MSG_MOVE_E4 MSG_N1 MSG_N2 MSG_N3 MSG_N4 MSG_DIAM_E1 MSG_DIAM_E2 MSG_DIAM_E3 MSG_DIAM_E4 MSG_E1 MSG_E2 MSG_E3 MSG_E4"
|
||||
|
||||
for i in `awk '/#define/{print $2}' language_en.h`; do
|
||||
for j in `ls language_*.h | grep -v language_en.h`; do
|
||||
t=$(grep -c "${i}" ${j})
|
||||
if [ "$t" -eq 0 ]; then
|
||||
for k in ${IGNORE_DEFINES}; do
|
||||
[ "${k}" == "${i}" ] && continue 2;
|
||||
done
|
||||
echo "${j},${i}"
|
||||
fi
|
||||
done
|
||||
done
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
git push --set-upstream origin `git branch | grep \* | sed 's/\* //g'`
|
@ -1,186 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# This file is for preprocessing gcode and the new G29 Autobedleveling from Marlin
|
||||
# It will analyse the first 2 Layer and return the maximum size for this part
|
||||
# After this it will replace with g29_keyword = ';MarlinG29Script' with the new G29 LRFB
|
||||
# the new file will be created in the same folder.
|
||||
|
||||
# your gcode-file/folder
|
||||
folder = './'
|
||||
my_file = 'test.gcode'
|
||||
|
||||
# this is the minimum of G1 instructions which should be between 2 different heights
|
||||
min_g1 = 3
|
||||
|
||||
# maximum number of lines to parse, I don't want to parse the complete file
|
||||
# only the first plane is we are interested in
|
||||
max_g1 = 100000000
|
||||
|
||||
# g29 keyword
|
||||
g29_keyword = 'g29'
|
||||
g29_keyword = g29_keyword.upper()
|
||||
|
||||
# output filename
|
||||
output_file = folder + 'g29_' + my_file
|
||||
# input filename
|
||||
input_file = folder + my_file
|
||||
|
||||
# minimum scan size
|
||||
min_size = 40
|
||||
probing_points = 3 # points x points
|
||||
|
||||
# other stuff
|
||||
min_x = 500
|
||||
min_y = min_x
|
||||
max_x = -500
|
||||
max_y = max_x
|
||||
last_z = 0.001
|
||||
|
||||
layer = 0
|
||||
lines_of_g1 = 0
|
||||
|
||||
gcode = []
|
||||
|
||||
|
||||
# return only g1-lines
|
||||
def has_g1(line):
|
||||
return line[:2].upper() == "G1"
|
||||
|
||||
|
||||
# find position in g1 (x,y,z)
|
||||
def find_axis(line, axis):
|
||||
found = False
|
||||
number = ""
|
||||
for char in line:
|
||||
if found:
|
||||
if char == ".":
|
||||
number += char
|
||||
elif char == "-":
|
||||
number += char
|
||||
else:
|
||||
try:
|
||||
int(char)
|
||||
number += char
|
||||
except ValueError:
|
||||
break
|
||||
else:
|
||||
found = char.upper() == axis.upper()
|
||||
try:
|
||||
return float(number)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
# save the min or max-values for each axis
|
||||
def set_mima(line):
|
||||
global min_x, max_x, min_y, max_y, last_z
|
||||
|
||||
current_x = find_axis(line, 'x')
|
||||
current_y = find_axis(line, 'y')
|
||||
|
||||
if current_x is not None:
|
||||
min_x = min(current_x, min_x)
|
||||
max_x = max(current_x, max_x)
|
||||
if current_y is not None:
|
||||
min_y = min(current_y, min_y)
|
||||
max_y = max(current_y, max_y)
|
||||
|
||||
return min_x, max_x, min_y, max_y
|
||||
|
||||
|
||||
# find z in the code and return it
|
||||
def find_z(gcode, start_at_line=0):
|
||||
for i in range(start_at_line, len(gcode)):
|
||||
my_z = find_axis(gcode[i], 'Z')
|
||||
if my_z is not None:
|
||||
return my_z, i
|
||||
|
||||
|
||||
def z_parse(gcode, start_at_line=0, end_at_line=0):
|
||||
i = start_at_line
|
||||
all_z = []
|
||||
line_between_z = []
|
||||
z_at_line = []
|
||||
# last_z = 0
|
||||
last_i = -1
|
||||
|
||||
while len(gcode) > i:
|
||||
try:
|
||||
z, i = find_z(gcode, i + 1)
|
||||
except TypeError:
|
||||
break
|
||||
|
||||
all_z.append(z)
|
||||
z_at_line.append(i)
|
||||
temp_line = i - last_i -1
|
||||
line_between_z.append(i - last_i - 1)
|
||||
# last_z = z
|
||||
last_i = i
|
||||
if 0 < end_at_line <= i or temp_line >= min_g1:
|
||||
# print('break at line {} at heigth {}'.format(i, z))
|
||||
break
|
||||
|
||||
line_between_z = line_between_z[1:]
|
||||
return all_z, line_between_z, z_at_line
|
||||
|
||||
|
||||
# get the lines which should be the first layer
|
||||
def get_lines(gcode, minimum):
|
||||
i = 0
|
||||
all_z, line_between_z, z_at_line = z_parse(gcode, end_at_line=max_g1)
|
||||
for count in line_between_z:
|
||||
i += 1
|
||||
if count > minimum:
|
||||
# print('layer: {}:{}'.format(z_at_line[i-1], z_at_line[i]))
|
||||
return z_at_line[i - 1], z_at_line[i]
|
||||
|
||||
|
||||
with open(input_file, 'r') as file:
|
||||
lines = 0
|
||||
for line in file:
|
||||
lines += 1
|
||||
if lines > 1000:
|
||||
break
|
||||
if has_g1(line):
|
||||
gcode.append(line)
|
||||
file.close()
|
||||
|
||||
start, end = get_lines(gcode, min_g1)
|
||||
for i in range(start, end):
|
||||
set_mima(gcode[i])
|
||||
|
||||
print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
|
||||
|
||||
# resize min/max - values for minimum scan
|
||||
if max_x - min_x < min_size:
|
||||
offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5) # int round up
|
||||
# print('min_x! with {}'.format(int(max_x - min_x)))
|
||||
min_x = int(min_x) - offset_x
|
||||
max_x = int(max_x) + offset_x
|
||||
if max_y - min_y < min_size:
|
||||
offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5) # int round up
|
||||
# print('min_y! with {}'.format(int(max_y - min_y)))
|
||||
min_y = int(min_y) - offset_y
|
||||
max_y = int(max_y) + offset_y
|
||||
|
||||
|
||||
new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
|
||||
max_x,
|
||||
min_y,
|
||||
max_y,
|
||||
probing_points)
|
||||
|
||||
out_file = open(output_file, 'w')
|
||||
in_file = open(input_file, 'r')
|
||||
|
||||
for line in in_file:
|
||||
if line[:len(g29_keyword)].upper() == g29_keyword:
|
||||
out_file.write(new_command)
|
||||
print('write G29')
|
||||
else:
|
||||
out_file.write(line)
|
||||
|
||||
file.close()
|
||||
out_file.close()
|
||||
|
||||
print('auto G29 finished')
|
@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfinfo
|
||||
#
|
||||
# Get the following helpful git info about the working directory:
|
||||
#
|
||||
# - Remote (upstream) Org name (MarlinFirmware)
|
||||
# - Remote (origin) Org name (your Github username)
|
||||
# - Repo Name (Marlin or MarlinDev)
|
||||
# - Marlin Target branch (RCBugFix or dev)
|
||||
# - Branch Name (the current branch or the one that was passed)
|
||||
#
|
||||
|
||||
REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
|
||||
|
||||
if [[ -z $REPO ]]; then
|
||||
echo "`basename $0`: No 'upstream' remote found." 1>&2 ; exit 1
|
||||
fi
|
||||
|
||||
ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
|
||||
|
||||
if [[ $ORG != MarlinFirmware ]]; then
|
||||
echo "`basename $0`: Not a Marlin repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$REPO" in
|
||||
Marlin ) TARG=RCBugFix ;;
|
||||
MarlinDev ) TARG=dev ;;
|
||||
esac
|
||||
|
||||
FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
|
||||
|
||||
case "$#" in
|
||||
0 ) BRANCH=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') ;;
|
||||
1 ) BRANCH=$1 ;;
|
||||
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
echo "$ORG $FORK $REPO $TARG $BRANCH"
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfnew
|
||||
#
|
||||
# Create a new branch based on RCBugFix or dev a given branch name
|
||||
#
|
||||
|
||||
MFINFO=$(mfinfo) || exit
|
||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||
TARG=${INFO[3]}
|
||||
|
||||
if [[ ${INFO[4]} == "(no" ]]; then
|
||||
echo "Branch is unavailable!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$#" in
|
||||
0 ) BRANCH=pr_for_$TARG-$(date +"%G-%d-%m|%H:%M:%S") ;;
|
||||
1 ) BRANCH=$1 ;;
|
||||
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
git checkout $TARG -b $BRANCH
|
@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfpr
|
||||
#
|
||||
# Make a PR of the current branch against RCBugFix or dev
|
||||
#
|
||||
|
||||
MFINFO=$(mfinfo "$@") || exit
|
||||
|
||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||
|
||||
ORG=${INFO[0]}
|
||||
FORK=${INFO[1]}
|
||||
REPO=${INFO[2]}
|
||||
TARG=${INFO[3]}
|
||||
BRANCH=${INFO[4]}
|
||||
|
||||
if [[ $BRANCH == "(no" ]]; then
|
||||
echo "Git is busy with merge, rebase, etc."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -z "$1" ]]; then { BRANCH=$1 ; git checkout $1 || exit 1; } fi
|
||||
|
||||
if [[ $BRANCH == $TARG ]]; then
|
||||
echo "Can't make a PR from $BRANCH" ; exit
|
||||
fi
|
||||
|
||||
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
|
||||
|
||||
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
|
||||
URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
|
||||
|
||||
if [ -z "$TOOL" ]; then
|
||||
echo "Can't find a tool to open the URL:"
|
||||
echo $URL
|
||||
else
|
||||
echo "Opening a New PR Form..."
|
||||
"$TOOL" "$URL"
|
||||
fi
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfprune
|
||||
#
|
||||
# Prune all your merged branches and any branches whose remotes are gone
|
||||
# Great way to clean up your branches after messing around a lot
|
||||
#
|
||||
|
||||
echo "Pruning Merged Branches..."
|
||||
git branch --merged | egrep -v "^\*|RC|RCBugFix|dev" | xargs -n 1 git branch -d
|
||||
echo
|
||||
|
||||
echo "Pruning Remotely-deleted Branches..."
|
||||
git branch -vv | egrep -v "^\*|RC|RCBugFix|dev" | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D
|
||||
echo
|
||||
|
||||
echo "You may want to remove these remote tracking references..."
|
||||
comm -23 \
|
||||
<(git branch --all | sed 's/^[\* ] //' | grep origin/ | grep -v "\->" | awk '{ print $1; }' | sed 's/remotes\/origin\///') \
|
||||
<(git branch --all | sed 's/^[\* ] //' | grep -v remotes/ | awk '{ print $1; }') \
|
||||
| awk '{ print "git branch -d -r origin/" $1; }'
|
||||
echo
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfrb
|
||||
#
|
||||
# Do "git rebase -i" against the "target" branch (RCBugFix or dev)
|
||||
#
|
||||
|
||||
MFINFO=$(mfinfo) || exit
|
||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||
|
||||
if [[ ${INFO[4]} == "(no" ]]; then
|
||||
echo "Branch is unavailable!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$#" in
|
||||
0 ) ;;
|
||||
* ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
git rebase -i ${INFO[3]}
|
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfup
|
||||
#
|
||||
# Fetch and merge upstream changes, optionally with a branch
|
||||
#
|
||||
|
||||
MFINFO=$(mfinfo) || exit
|
||||
|
||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||
|
||||
ORG=${INFO[0]}
|
||||
FORK=${INFO[1]}
|
||||
REPO=${INFO[2]}
|
||||
TARG=${INFO[3]}
|
||||
OLDBRANCH=${INFO[4]}
|
||||
|
||||
if [[ $OLDBRANCH == "(no" ]]; then
|
||||
echo "Branch is unavailable!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$#" in
|
||||
0 ) BRANCH=$OLDBRANCH ;;
|
||||
1 ) BRANCH=$1 ;;
|
||||
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
set -e
|
||||
|
||||
echo "Fetching upstream ($ORG/$REPO)..."
|
||||
git fetch upstream
|
||||
|
||||
echo ; echo "Bringing $TARG up to date..."
|
||||
git checkout -q $TARG || git branch checkout upstream/$TARG -b $TARG && git push --set-upstream origin $TARG
|
||||
git merge upstream/$TARG
|
||||
git push origin
|
||||
|
||||
if [[ $BRANCH != $TARG ]]; then
|
||||
echo ; echo "Rebasing $BRANCH on $TARG..."
|
||||
if git checkout $BRANCH; then
|
||||
echo
|
||||
if git rebase $TARG; then
|
||||
git push -f ; echo
|
||||
[[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH
|
||||
else
|
||||
echo "Looks like merge conflicts. Stopping here."
|
||||
fi
|
||||
else
|
||||
echo "No such branch!" ; echo
|
||||
git checkout $OLDBRANCH
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user