Re: questions about cg-update, cg-pull, and cg-clone.
- From
David A. Wheeler <dwheeler@dwheeler.com>
- Date
- Apr 30, 2005, 02:37 UTC
- Message-ID
- <4272EF69.2090806@dwheeler.com>
- In-Reply-To
- <20050430005322.GA5408@tumblerings.org>
Zack Brown wrote:
Show 8 quoted lines
> Hi, > > I'm trying to figure out the new Cogito syntax. What is the difference between > cg-update and cg-pull? Here is my take so far, please correct me: > > 'cg-update branch-name' grabs any new changes from the upstream repository and > merges them into my local repository. If I've been editing files in my local > repository, the update attempts to merge the changes cleanly.
Yes. "cg-update branch-name" is EXACTLY the same as cg-pull branch-name && cg-merge branch-name You can see this by examining the last lines of the cg-update script. Because updating is one of the single most common operations for an SCM, it makes sense to have a single command that does it.
Currently cg-update without a branch name does "recover deleted files" instead, but I think that's a wart & Petr agrees (that will probably get moved to a different command, see separate discussion).
> Now, if the update is clean, a cg-commit is invoked automatically,
Correct; cg-merge calls "cg-commit -C" (ignore cache) if the merge is clean.
> and if the > update is not clean, I then have to resolve any conflicts and give the cg-commit > command by hand.
Correct.
> But: what is the significance of either of these cg-commit > commands? Why should I have to write a changelog entry recording this merge? All > I'm doing is updating my tree to be current. Why should I have to 'commit' that > update?
I can't speak Petr, but I would guess that he's doing that because he's trying to avoid data loss.
> Now I look at 'cg-pull'. What does this do? The readme says something about > printing two ids, and being useful for diffs. But can't I do a diff after a > cg-update and get the same result? I'm very confused about cg-pull right now.
cg-pull BRANCH copies any changes from the named branch into your repository. You could do a diff afterwards, yes, to get the same results as long as the data is in your repository. However, after a successful merge the HEAD will be different from before a successful merge, so the DEFAULT answers from a diff will be different.
> Also, the README says that cg-clone and cg-init are identical, except that > cg-clone creates a new directory for the repository. Is that really the only > difference? Why do we have cg-clone then?
You'll have to ask Petr. My guess is that he has bigger plans for cg-clone, what you're seeing is just the current stub.
Anyway, hope my guessing helps.
--- David A. Wheeler