Changeset 1890 for trunk/scripts


Ignore:
Timestamp:
Dec 24, 2008, 11:33:25 PM (15 years ago)
Author:
broder
Message:

I'm not happy with the semantics of that first go at
mergeHistory. Let's try again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/git-migration/git-migrate

    r1889 r1890  
    4545                           'file:///%s/%s.git' % (cwd, new_pkg),
    4646                           'master:refs/heads/%s' % old_pkg],
    47                           cwd='%s.git' % new_pkg)
    48    
    49     graft = []
    50     p = subprocess.Popen(['git', 'rev-list',
    51                           '--reverse',
    52                           '--skip=%s' % n,
    53                           'master'],
    54                          cwd='%s.git' % new_pkg,
    55                          stdout=subprocess.PIPE)
    56     p.wait()
    57     new_rev = p.stdout.read().split()[0]
    58     graft.append(new_rev)
    59    
    60     # If n isn't 0, then n has a parent commit already that we
    61     # shouldn't forget about.
    62     if n != 0:
    63         p = subprocess.Popen(['git', 'rev-parse',
    64                               '%s^' % new_rev],
    65                              cwd='%s.git' % new_pkg,
    66                              stdout=subprocess.PIPE)
    67         p.wait()
    68         graft.append(p.stdout.read().strip())
    69    
    70     # And regardless, the HEAD of old_pkg should be a parent of
    71     # new_pkg
    72     p = subprocess.Popen(['git', 'rev-parse',
    73                           'master'],
    74                          cwd='%s.git' % old_pkg,
    75                          stdout=subprocess.PIPE)
    76     p.wait()
    77     graft.append(p.stdout.read().strip())
    78    
    79     f = open('%s.git/info/grafts' % new_pkg, 'a')
    80    
    81     print >>f, ' '.join(graft)
     47                          cwd='%s.git' % old_pkg)
    8248
    8349def mergeHistories():
     
    9258    for merge in merges:
    9359        mergeHistory(*merge)
    94    
    95     for line in open('package-list'):
    96         line = line.strip()
    97         subprocess.check_call(['git', 'filter-branch',
    98                                '--',
    99                                '--all'],
    100                               cwd='%s.git' % line)
    101    
    102     for merge in merges:
    103         shutil.rmtree('%s.git' % merge[0])
    10460
    10561if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.