On Fri, Jul 31, 2015 at 05:37:12PM +0200, Clément Bœsch wrote:
[...]
> So in order for the community to continue this, I'd say we probably need
> to have some help for:
> 
> - guidelines on the merge strategies

The merge process i used is quite simple

1.
merge.conflictstyle=diff3 (in git config somewhere)

2.
git fetch --all

3.
git log ..qatar/master    --pretty='%H %s'

4. pick one hash at a time into (start with the oldest)
git merge --stat --log  <hash here>   -Xrename-threshold=10 -Xpatience | sort

then open files in text editor and edit code in conflict markers to
simplify. Also simple search and replace is very usefull like if a
variable rename is merged, do a merge + do the rename over the conflict
markered code

if needed you can copy and paste a conflict block into the murge script
which will show it in a nicer colored form

then run the spitfire script as often as you want during the process
(no arguments required)
it will fix up license headers, and simplify all conflicts which have
after any renaming or editing become trivial. So doing a merge of a
rename initially might result in hundreads of conflicts and after
redoing the rename and spitfire you then possibly have only 10 or
so left to resolve by hand.

There are hundreads of other tools out there to resolve merge
conflicts, above is just what i used for 99% of my merges

ahh and sedf, which runs a sed command over the files specified after
it,

all very basic scripts really, no magic

ahh and to add fate samples, you need to be in the samples group
on the server you are one of the roots so that should be fine

and then to update fate samples drop em locally in your directory
and use a script like this:

rsync -vauL --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
ffmpeg.org:/home/samples/fate-suite/ ~/fatesamples/fate/fate-suite
rsync -vauL --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
f...@fate.ffmpeg.org:/var/www/fateweb/fate-suite/ ~/fatesamples/fate/fate-suite

echo dry runs next
rsync -vanL --no-g --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
~/fatesamples/fate/fate-suite/ f...@fate.ffmpeg.org:/var/www/fateweb/fate-suite
rsync -vanL --no-g --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
~/fatesamples/fate/fate-suite/ ffmpeg.org:/home/samples/fate-suite
echo NEXT will be upload check the 2 above!
rsync -vaL  --no-g --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
~/fatesamples/fate/fate-suite/ f...@fate.ffmpeg.org:/var/www/fateweb/fate-suite
rsync -vaL  --no-g --chmod=Dg+s,Duo+x,ug+rw,o+r,o-w,+X 
~/fatesamples/fate/fate-suite/ ffmpeg.org:/home/samples/fate-suite


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
#!/bin/sh

grep -A99999 '<<<<<<<' | grep -B99999 '>>>>>>>' >murge.X
grep -A9999 '====' murge.X | egrep -v '=======|<<<<<<<|>>>>>>>|\|\|\|\|\|\|\|' 
>murge.theirs
grep -B9999 '||||' murge.X | egrep -v '=======|<<<<<<<|>>>>>>>|\|\|\|\|\|\|\|' 
>murge.ours
grep -B9999 '====' murge.X | grep -A9999 '||||' | egrep -v 
'=======|<<<<<<<|>>>>>>>|\|\|\|\|\|\|\|'  >murge.common

colordiff -du $* murge.ours murge.theirs
grep . murge.common > /dev/null && colordiff -du $* murge.common murge.theirs
grep . murge.common > /dev/null && colordiff -du $* murge.common murge.ours
rm murge.theirs murge.common murge.ours murge.X


#!/usr/bin/python

import sys
import os
import stat
import re
import subprocess;

def cleanhunk(out, ours, old, theirs, func):
    global taken_ours, taken_theirs
    if func :
        ours = func(ours)
        old  = func(old)

    if ours == theirs or theirs == old:
        out.write(ours)
        taken_ours += 1
        return 1
    elif ours == old :
        out.write(theirs)
        taken_theirs += 1
        return 2
    else :
        return 0

def docosmetics( s ):
    sys.stderr.write( "before: \n" + s + "\n" )
    #we ommit * due to pointer definitions like (MpegEncContext *s
    s = re.sub("([])0-9a-zA-Z]) ?( *)(=|\+=|-=|%=|/=|\+|-|<|>|<=|>=|==|!=|&|/|%) ?( *)([(0-9a-zA-Z])", "\\g<1> \\g<2>\\g<3>\\g<4> \\g<5>", s);
    s = re.sub("([])0-9a-zA-Z]) ?( *)(=)\n", "\\g<1> \\g<2>\\g<3>\n", s);

    s = re.sub("//([A-Za-z0-9])", "// \\g<1>", s);
    s = re.sub("\){", ") {", s);
    s = re.sub("(if|while|for)\(", "\\g<1> (", s);
    s = re.sub("}else", "} else", s);
    s = re.sub("else{", "else {", s);

    #HACK repair #includes
    s = re.sub("(#include.*) / (.*)", "\\g<1>/\\g<2>", s);
    s = re.sub("(#include.*) / (.*)", "\\g<1>/\\g<2>", s);

    #HACK repair <a@b>
    s = re.sub("< ([0-9a-zA-Z]*@)", "<\\g<1>", s);

    sys.stderr.write( "after: \n" + s + "\n" )
    return s

def cleanfile( filename, fix_libav ):
    global taken_ours, taken_theirs
    taken_ours = taken_theirs = taken_conflict = taken_trick = 0
    fffix = 0

    state = 0
    ours = theirs = old = ""

    sys.stderr.write( filename + "\n" )

    infile = open(filename)
    outfile= open("spitfire.tmp", "wb")
    instring = infile.read()
    infile.close()

    if fix_libav:
        m = re.subn("This file is part of Libav", "This file is part of FFmpeg", instring)
        fffix += m[1]
        m = re.subn("Libav is free software; you can redistribute it and/or", "FFmpeg is free software; you can redistribute it and/or", m[0])
        fffix += m[1]
        m = re.subn("Libav is distributed in the hope that it will be useful", "FFmpeg is distributed in the hope that it will be useful", m[0])
        fffix += m[1]
        #m = re.subn("License along with Libav; if not, write to the Free Software", "License along with FFmpeg; if not, write to the Free Software", m[0])
        #fffix += m[1]
        m = re.subn("with Libav; if not, write to the Free Software", "with FFmpeg; if not, write to the Free Software", m[0])
        fffix += m[1]
        instring = m[0]

    initer = re.split('([^\n]*\n)', instring)
    out    = outfile

    for line in initer:
        if state == 0 :
            if line.startswith("<<<<<<<") :
                sep0 = line
                state = 1
            else :
                out.write(line)
        elif state == 1 :
            if line.startswith("|||||||") :
                sep1 = line
                state = 2
            else :
                ours = ours + line;
        elif state == 2 :
            if line.startswith("=======") :
                sep2 = line
                state = 3
            else :
                old = old + line;
        elif state == 3 :
            if line.startswith(">>>>>>>") :
                sep3 = line
                state = 0
                if     cleanhunk(out, ours, old, theirs, None) :
                    None
                #elif   cleanhunk(out, ours, old, theirs, docosmetics) :
                    #taken_trick += 1
                    #None
                else :
                    out.write(sep0 + ours + sep1 + old + sep2 + theirs + sep3)
                    taken_conflict += 1
                ours = theirs = old = ""
            else :
                theirs = theirs + line;

    outfile.close()

    if fffix > 0:
        sys.stderr.write("FFFix:" + `fffix` + "\n")

    if taken_ours>0 or taken_theirs>0:
        sys.stderr.write("    Ours:" + `taken_ours`
                       + " Theirs:" + `taken_theirs`
                       + " Conflict:" + `taken_conflict`
                       + " Trick:" + `taken_trick` +"\n")

    if fffix > 0 or taken_ours>0 or taken_theirs>0:
        st = os.stat(filename)
        os.rename(filename, filename+"~")
        os.rename("spitfire.tmp", filename)
        os.chmod(filename, st.st_mode)


proc = subprocess.Popen(['git', 'grep', 'This file is part of Libav', 'HEAD^'],stdout=subprocess.PIPE)
streamdata = proc.communicate()[0]
fix_libav = proc.returncode != 0

if len(sys.argv) == 1 :
    searchstring = '\|\|\|\|\|\|'
    if fix_libav :
        searchstring += '|This file is part of Libav'
    proc = subprocess.Popen(['git', 'grep', '-l', '-E', searchstring], stdout=subprocess.PIPE)
    for line in proc.stdout:
        cleanfile(line.rstrip(), fix_libav)
else:
    for arg in sys.argv[1:] :
        cleanfile(arg, fix_libav)

st = os.stat('configure')
os.chmod('configure', st.st_mode | stat.S_IEXEC)
#!/bin/sh

set -e

CMD="$1"
shift
for i in $* ; do
    test -f $i
    cp -p $i $i~ && sed "$CMD" $i~ > $i
done

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to