[PATCH] hgit.py v2

Matt Mackall mpm at selenic.com
Fri Jun 3 20:17:15 UTC 2005


On Fri, Jun 03, 2005 at 10:46:28AM -0400, Chris Mason wrote:
> Hello everyone,
> 
> Here's another rev of my git compatibility patch.  This implements basic 
> support for:
> 
> hg rev-tree
> hg rev-list
> hg cat-file
> hg diff-tree

The code looks fine, the organization is still not quite how I wanted
it.

Basically, I want gitk to call a command called hgit for the git-like
bits, and not hg. And put all the git-related stuff in hgit.

> --- a/hg Mon May 30 18:21:21 2005
> +++ b/hg Fri Jun  3 10:14:50 2005
> @@ -17,7 +17,7 @@
>  #    pass
>  
>  import sys, os, time
> -from mercurial import hg, mdiff, fancyopts
> +from mercurial import hg, mdiff, fancyopts, hgit

So this ought to remain git-ignorant.

> -def diff(files = None, node1 = None, node2 = None):
> -    def date(c):
> -        return time.asctime(time.gmtime(float(c[2].split(' ')[0])))

We perhaps need to move this to mercurial/utils.py (in a separate
patch of course).

> +elif cmd == "diff-tree":
> +    hgit.difftree(args, repo)
> +
> +elif cmd == "cat-file":
> +    hgit.catfile(args, ui, repo)
> +
> +elif cmd == "rev-tree":
> +    hgit.revtree(args, repo)
> +
> +elif cmd == "rev-list":
> +    hgit.revlist(args, repo)
> +

And these bits (and not much else) live in hgit

> --- a/mercurial/hgit.py Mon May 30 18:21:21 2005
> +++ b/mercurial/hgit.py Fri Jun  3 10:14:50 2005
> @@ -1,0 +1,198 @@
> +import time, sys
> +from mercurial import hg, mdiff, fancyopts

And this stuff too.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list