From owner-freebsd-git@freebsd.org Fri Sep 25 17:23:27 2020 Return-Path: Delivered-To: freebsd-git@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 363CE3FDC08 for ; Fri, 25 Sep 2020 17:23:27 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4Bydzf51YBz4HGc for ; Fri, 25 Sep 2020 17:23:26 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id AC3333FD2F8; Fri, 25 Sep 2020 17:23:26 +0000 (UTC) Delivered-To: git@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABFA83FDA17 for ; Fri, 25 Sep 2020 17:23:26 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bydzf2k7Yz4Gw2; Fri, 25 Sep 2020 17:23:26 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: by mail-oi1-f193.google.com with SMTP id v20so3559328oiv.3; Fri, 25 Sep 2020 10:23:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/9561GinojvSXtYCl+lAUQpzDYJFW2iFnxsnxkh2h/8=; b=S+GqhikpxS9w3YAc6xG0g0rqBfDEw05MeOYNMdaKkJ3fIijgErxmWwDHUDRa7bCoGr eflZiPiXZm0TyvCkML5vl2hml6CBp1InsrmC68yey6vntnHsbQQe1XOk3PxJzlW6blK4 9vPbqyCQLDHhmb3cELTwp+Ow65NuZZ10MT3Oh0r9KQjfqf9J9BPOVy8H1GjMcZd8gfI+ ZZTI9+OJFMXHTCcneHLmvIbZNTEgpKX3gLZmb4mrWKf3LLQKd9OxaT43E/tvJxjURnTs M7v35CdexQ+Cja8Wg9LjpSDEB/1zZ4lV3IqZPjdv8PVVwj241uFCmRx1FujnWtF0IA0P 1VBw== X-Gm-Message-State: AOAM532Xtmo64cB3p1CWglIxUnd5UsnWBPUaTB12J/ucPyXZYErNbiQi OjoYegP9lqKZSsnG2jMXLBE2VO7qXnDt5VJPC4meQVCjt+o= X-Google-Smtp-Source: ABdhPJwHkQnCS54DRX22MPL1NQle91djfgaQ6mPFRUlO3bxlN1/IBEb03VsorhGRSvfaLwgKshS+V6kkahtZCsXpVKs= X-Received: by 2002:aca:49c2:: with SMTP id w185mr193582oia.101.1601054604947; Fri, 25 Sep 2020 10:23:24 -0700 (PDT) MIME-Version: 1.0 References: <20200924201715.GR1390@albert.catwhisker.org> <20200924205326.GB64154@spindle.one-eyed-alien.net> In-Reply-To: <20200924205326.GB64154@spindle.one-eyed-alien.net> From: =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= Date: Fri, 25 Sep 2020 19:23:07 +0200 Message-ID: Subject: Re: Question on (my) workflow migration svn -> git To: Brooks Davis Cc: git@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Bydzf2k7Yz4Gw2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-BeenThere: freebsd-git@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussion of git use in the FreeBSD project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Sep 2020 17:23:27 -0000 On Thu, Sep 24, 2020 at 10:53 PM Brooks Davis wrote: > > On Thu, Sep 24, 2020 at 01:17:15PM -0700, David Wolfskill wrote: > > The migration (of my workflow) from cvs to svn was more "cosmetic" > > than anything else -- the data store changed and the commands > > changed, but the underlying thought processes behind what I was > > doing stayed pretty much the same. > > > > I have no idea if that will be the case for svn -> git, so I'm > > putting this out for comments and, perhaps, some useful advice from > > folks who are more familiar with git than I am. > > > > Please note: I am not a FreeBSD committer. I have no desire (let > > alone requirement) to cause changes to the FreeBSD code base to > > show up with my fingerprints on them. > > > > Details on the below-described workflow may be found at > > http://www.catwhisker.org/~david/FreeBSD/upgrade.html; the current > > state of things may be seen at > > http://www.catwhisker.org/~david/FreeBSD/history/ (in case either > > of those is of interest). > > > > TL; DR: I sync private local mirrors, update working copies, then make > > the running systems match the working copies. > > > > Details: > > I have a couple of machines that I consider "development" machines; > > one is the laptop that I use for day-to-day activities; the other > > is a dedicated "build machine" (named "freebeast"). On ecah of > > these machines, I perform a daily update of: > > > > * FreeBSD stable/${head - 1} [currently: 12] > > * Locally-installed ports (using the ports "head" branch) > > * FreeBSD head > > > > Perhaps more significantly, I keep the two machines in lock-step, > > as my activities on my laptop constitute the bulk of my testing of > > what will be installed on my small handful of "production" machines > > each Sunday (as they get the most recent snapshot of stable/${head > > - 1} that freebeast built Sunday morning). > > > > To keep them in lock-step, the build machine performs a cron-initiated > > "svnsync" to update a local private mirror of the svn repositories > > (src, ports, and doc). For the laptop, it depends: > > > > * If I'm away from home, it also does the same sort of svnsync (at > > the same time). > > * If I'm home, it waits a couple of minutes, then does an rsync > > from the build machine's private local mirror. > > > > In any case, each of them has a private local mirror that is only > > updated by the "mirroring" operation -- I don't commit to it. > > > > For each of stable/${head - 1}, head, and ports, the appopriate svn > > working copy is updated, using the svn repo as a read-only reference. > > > > Thus (for example), when FreeBSD stable/12 was branched, it was > > straightforward for me to "clone" the slice used for head (to a > > slice that I was not actively using until then), then use "svn > > switch" to change the src working copy to point to stable/12 (vs. > > head) -- there would be little substantitiative change, so the > > behavior should be quite similar to what I had already experienced > > with head. And once I was comfortable with stable/12, I could > > "clone" that to overlay the old stable/11 slice. > > > > (I've been doing this -- well, substitute a few references to cvs > > inplace of the svn ones for early days -- since around FreeBSD 3.x > > (I'm pretty sure I skipped 5.x, though). And it's been working > > pretty well for me so far. I've evn been able to point out an > > occasional breakage now and then.) > > > > So: Is doing something ... similar ... to the above feasible using > > git (vs. svn)? And if so, may I have a pointer or two to get me > > started? Because it's not at all obvious to me how to accomplish > > it. (E.g., in my use of git so far, the notions of "repository" > > and "working copy" seem to be conflated, which does not lead to > > warm and fuzzy feelings on my part.) > > To continue having the local mirror of the git repo you could use `git > clone --bare ` to download a copy and not checkout out > a work tree. I believe your daily updates updates would just be `git > fetch`, but I haven't worked with bare repos much. You could then do > a local clone of that (at the cost of two complete copies of FreeBSD > history). > > Your laptop situation is more complicated, but I think I see how it > could work. You'd initially clone from your local buildbox's mirror > with something like `git clone ssh://freebeast/path/to/freebsd/repo`. > You'd then checkout out whatever branch you wanted and update with `git > pull`. To handle the away scenario you have two choices, you can change > your url of your remote branch to point to upstream freebsd and update > as usual or your could add a second remote (e.g. freebsd vs the default > origin) and perform a "fast-foward" merge from the corresponding branch > on that remote to your working branch. This would look something like > the following (totally untested with made up branch names) example: > > git clone ssh://freebeast/path/to/freebsd/repo freebsd > cd freebsd > git remote add freebsd > git checkout stable/12 > > So long as you don't commit any local changes your update process at > home would look like: > > cd freebsd > git pull > > To update while away, you'd so something like: > > cd freebsd > git fetch freebsd > git merge --ff-only freebsd/stable/12 > > I don't see a good way to keep a bare repo on the laptop. > > I hope this give you an idea where to start. Why not a bare repo same as with the svnsync copies before? On each machine (doesn't matter if connected or not) he could: git clone --bare https://.../{src,ports} and "git fetch --all --prune" (or some combination) whenever internet connectivity exists. Then it's easy enough to clone from that local copy for the various branches, but it's obviously suboptimal. I recommend to read `man git-worktree`. From those bare repos, he could check out both stable/12 and head to some arbitrary location and keep them updated with ... um git pull I believe. so for svn switch, look at a bare clone + multiple worktrees (if you need just a single worktree, then don't do the bare repo, obviously). I also assume that your combination of svnsync + rsync was only due to speed, yes? You can ignore all that and always pull directly from the cgit.freebsd.org host or whatever the final URL will be. The savings in bandwidth are not worth it to do something else, but you can of course `git remote add ...` on your laptop and fetch first from the local clone and then from the internet. In short, the svnsync crutch is no longer needed, git can do that all natively and will be so much faster doing it, to boot. But, you'll need to read up on clones, fetches, bare repos, worktrees and other stuff. Happy to answer more questions, once you've played around a bit to get a feel for what's possible. Cheers Uli