summaryrefslogtreecommitdiff
path: root/applyPatch.go
blob: 18077c91f0e48f1b6a515995f9791185b3723763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

/*
// saves the patches in ~/.config/forge/currentpatches/
func savePatchset(pset *forgepb.Patchset) error {
	log.Info("savePatches() NAME", pset.Name)
	log.Info("savePatches() COMMENT", pset.Comment)
	log.Info("savePatches() GIT_AUTHOR_NAME", pset.GetGitAuthorName())
	log.Info("savePatches() GIT_AUTHOR_EMAIL", pset.GetGitAuthorEmail())
	log.Info("savePatches() Branch Name", pset.GetStartBranchName())
	log.Info("savePatches() Start Hash", pset.GetStartBranchHash())
}
*/

/*
// From 18ee541f89be2e9f9a91c54873da87885e8ffdf5 Mon Sep 17 00:00:00 2001
// From: Jeff Carr <[email protected]>
// Date: Sun, 5 Jan 2025 01:18:47 -0600
// Subject: [PATCH] 'forge dirty' will find and list only dirty repos

// list patches in jcarr but not in devel
// git log --format="%H %Subject" jcarr --not devel
func countCurrentPatches(repo *gitpb.Repo) int {
	cmd := []string{"git", "log", "--format=\"%H %s\"", "--no-merges", "jcarr", "--not", "devel"}
	result := repo.Run(cmd)
	return len(result.Stdout)
}

func doRegister(newurl string) error {
	var url string
	url = me.urlbase + "/register?url=" + newurl
	body, err := me.forge.HttpPost(url, nil)
	if err != nil {
		log.Info("httpPost() failed:", err)
		return err
	}

	test := strings.TrimSpace(string(body))
	for _, line := range strings.Split(test, "\n") {
		line = strings.TrimSpace(line)
		log.Info("server returned:", line)
	}
	return nil
}
*/