R7WB2ZZZMN4DUC7PGWRKW3QNWJQF4P6XDZIYLTBV4INJDHSBPZQQC
OLMQ7EVU4GITQMACZRI7VEGXG7GMZ4ZVKU4BNQUAJS3GEIBEOJMAC
YBAXM44PROCHZWNCOAFGQ3P25FN45KEICIRGC3PKAUIF3HF6PX7AC
RTQQLOCOBMMY5RQ6QI7TYKILLSSW5YNVPA33NL4MHM27QXMOCKPQC
KZ4XMKSPLDYKDWCDZXTIJXZPXUZPMGYSZAIIJTQQSYDZVWOZVI5AC
Y7VFVY6EMR7FMVCTPLBIYVRI2DJTOSUK7LSRRRIODT3G57FR7Z4QC
534I6MRXZVDW5W5OXRBCSTJ2WFZ4ECL6UQCIUNB46LSH3IJXJWDAC
2J4YY37DAVTCJJGWZFQ7PL4NBGW2LTBDA4I5CSY7SFPBG76AJI5QC
K23EJ6EJBFYC73TX5MMV7ZMI2GXVQJT6OQCGV56MXPQN4BLOQZ5AC
P2B4ZSO5YWG73KTDPO7KX5JNRNFDKF3UZEOJNGN22JRMAWQXFCSQC
changes[i].mark = m.Next()
if mark, ok := hashToMark[changes[i].Hash]; ok {
changes[i].mark = mark
changes[i].exported = true
} else {
changes[i].mark = m.Next()
m.changes = append(m.changes, markedChange{
mark: changes[i].mark,
hash: changes[i].Hash,
})
}
}
}
// Import loads a marks file analogous to those used by git fast-export's
// --import-marks and --export-marks switches.
func (m *Marks) Import(filename string) error {
f, err := os.Open(filename)
if err != nil {
return err
}
defer f.Close()
br := bufio.NewReader(f)
for {
var mc markedChange
n, err := fmt.Fscanf(br, ":%d %s\n", &mc.mark, &mc.hash)
if err == io.ErrUnexpectedEOF && n == 0 {
return nil
}
if err != nil {
return err
}
m.changes = append(m.changes, mc)
}
}
func (m *Marks) Export(filename string) error {
f, err := os.Create(filename)
if err != nil {
return err
var repo = flag.String("repo", ".", "path of the repository to export")
var channel = flag.String("channel", "main", "which channel to export")
var branch = flag.String("branch", "", "destination branch in Git (default is the same as channel)")
var (
repo = flag.String("repo", ".", "path of the repository to export")
channel = flag.String("channel", "main", "which channel to export")
branch = flag.String("branch", "", "destination branch in Git (default is the same as channel)")
markFile = flag.String("marks", "", "path to file to store persistent marks")
)