Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2014 16:21:25 -0400
From:      Glen Barber <gjb@FreeBSD.org>
To:        Lawrence Stewart <lstewart@freebsd.org>
Cc:        python@FreeBSD.org
Subject:   Re: [PATCH] devel/mercurial --authormapsuffix
Message-ID:  <20140622202125.GD1218@hub.FreeBSD.org>
In-Reply-To: <20140622195610.GC1218@hub.FreeBSD.org>
References:  <53A731CC.1000202@freebsd.org> <20140622195610.GC1218@hub.FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--S3Smgu5mAIHx+YOO
Content-Type: multipart/mixed; boundary="FyU5fTJCTr/6Eq8v"
Content-Disposition: inline


--FyU5fTJCTr/6Eq8v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Jun 22, 2014 at 03:56:11PM -0400, Glen Barber wrote:
> On Sun, Jun 22, 2014 at 12:43:08PM -0700, Lawrence Stewart wrote:
> > Hi Python team,
> >=20
> > As part of the set up and ongoing running of hg-beta.freebsd.org, I make
> > use of a patch against devel/mercurial which allows me to append a
> > suffix to author names during the svn -> hg incremental conversion proc=
ess.
> >=20
> > clusteradm@ are working to streamline the package management on cluster
> > hosts and it would simplify things for them if the hg-beta.freebsd.org
> > jail did not make use of any custom compiled software.
> >=20
> > The patch in question is at [1]. and after discussion with upstream
> > [2,3] it was decided not to fold it into the official Mercurial
> > distribution.
> >=20
> > I'm hoping you would be happy to carry the patch in our mercurial/devel
> > port as an off-by-default option which clusteradm@ can then enable for
> > cluster package builds via poudriere.
> >=20
>=20
> Something like what devel/bugzilla44 does would be perfect.  What that
> port does is includes an off-by-default FREEBSD option, which we can
> enable in the cluster, adding the patch in question as EXTRA_PATCHES.
>=20
>   % make -C devel/bugzilla44 -V FREEBSD_DESC
>   Patch used internally by the FreeBSD project
>=20

The attached diff against the devel/mercurial port seems to do what we
need.

Glen


--FyU5fTJCTr/6Eq8v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="devel-mercurial.diff.txt"
Content-Transfer-Encoding: quoted-printable

Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Makefile	(revision 358572)
+++ Makefile	(working copy)
@@ -14,10 +14,11 @@
 USE_PYTHON=3D	2
 USE_PYDISTUTILS=3Dyes
=20
-OPTIONS_DEFINE=3D	CA_BUNDLE DATA DOCS EXAMPLES NLS
+OPTIONS_DEFINE=3D	CA_BUNDLE DATA DOCS EXAMPLES NLS FREEBSD
 OPTIONS_DEFAULT=3DDATA
 OPTIONS_SUB=3D	yes
 CA_BUNDLE_DESC=3D	Install CA Certificates
+FREEBSD_DESC=3D	Patches used internally by the FreeBSD Project
=20
 CONTRIB_FILES=3D	bash_completion \
 		casesmash.py \
@@ -66,6 +67,10 @@
 EXTRA_PATCHES+=3D	${FILESDIR}/extra-patch-setup.py
 .endif
=20
+.if ${PORT_OPTIONS:MFREEBSD}
+EXTRA_PATCHES+=3D	${FILESDIR}/extra-patch-authormapsuffix
+.endif
+
 post-install:
 	${INSTALL_MAN} ${WRKSRC}/doc/*.1 ${STAGEDIR}${PREFIX}/man/man1/
 	${INSTALL_MAN} ${WRKSRC}/doc/*.5 ${STAGEDIR}${PREFIX}/man/man5/
Index: files/extra-patch-authormapsuffix
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- files/extra-patch-authormapsuffix	(revision 0)
+++ files/extra-patch-authormapsuffix	(working copy)
@@ -0,0 +1,166 @@
+--- hgext/convert/__init__.py.orig	2014-06-01 17:15:14.000000000 -0400
++++ hgext/convert/__init__.py	2014-06-22 16:11:35.609199105 -0400
+@@ -85,6 +85,9 @@
+=20
+     Empty lines and lines starting with a ``#`` are ignored.
+=20
++    The authormapsuffix can be used to append set text to each
++    post-authormap-translated author name.
++
+     The filemap is a file that allows filtering and remapping of files
+     and directories. Each line can contain one of the following
+     directives::
+@@ -314,6 +317,8 @@
+            _('import up to source revision REV'), _('REV')),
+           ('A', 'authormap', '',
+            _('remap usernames using this file'), _('FILE')),
++          ('', 'authormapsuffix', '',
++           _('append this suffix to remapped author names'), _('SUFFIX')),
+           ('', 'filemap', '',
+            _('remap file names using contents of file'), _('FILE')),
+           ('', 'splicemap', '',
+--- hgext/convert/convcmd.py.orig	2014-06-01 17:15:14.000000000 -0400
++++ hgext/convert/convcmd.py	2014-06-22 16:11:35.610199033 -0400
+@@ -103,12 +103,15 @@
+         self.commitcache =3D {}
+         self.authors =3D {}
+         self.authorfile =3D None
++        self.authormapsuffix =3D ''
+=20
+         # Record converted revisions persistently: maps source revision
+         # ID to target revision ID (both strings).  (This is how
+         # incremental conversions work.)
+         self.map =3D mapfile(ui, revmapfile)
+=20
++        if opts.get('authormapsuffix'):
++            self.authormapsuffix =3D opts.get('authormapsuffix')
+         # Read first the dst author map if any
+         authorfile =3D self.dest.authorfile()
+         if authorfile and os.path.exists(authorfile):
+@@ -356,7 +359,7 @@
+                 continue
+=20
+             srcauthor =3D srcauthor.strip()
+-            dstauthor =3D dstauthor.strip()
++            dstauthor =3D dstauthor.strip() + self.authormapsuffix
+             if self.authors.get(srcauthor) in (None, dstauthor):
+                 msg =3D _('mapping author %s to %s\n')
+                 self.ui.debug(msg % (srcauthor, dstauthor))
+@@ -370,7 +373,8 @@
+=20
+     def cachecommit(self, rev):
+         commit =3D self.source.getcommit(rev)
+-        commit.author =3D self.authors.get(commit.author, commit.author)
++        commit.author =3D self.authors.get(commit.author,
++                                         commit.author + self.authormapsu=
ffix)
+         # If commit.branch is None, this commit is coming from the source
+         # repository's default branch and destined for the default branch=
 in the
+         # destination repository. For such commits, passing a literal "No=
ne"
+--- tests/test-convert-authormap.t.orig	2014-06-01 17:15:14.000000000 -0400
++++ tests/test-convert-authormap.t	2014-06-22 16:11:35.610199033 -0400
+@@ -10,6 +10,8 @@
+   $ cd orig
+   $ echo foo > foo
+   $ HGUSER=3D'user name' hg ci -qAm 'foo'
++  $ echo bar > bar
++  $ HGUSER=3D'user name 2' hg ci -qAm 'bar'
+   $ cd ..
+=20
+ Explicit --authors
+@@ -26,13 +28,19 @@
+   scanning source...
+   sorting...
+   converting...
+-  0 foo
++  1 foo
++  0 bar
+   writing author map file $TESTTMP/new/.hg/authormap (glob)
+   $ cat new/.hg/authormap
+   user name=3DLong User Name
+   $ hg -Rnew log
+-  changeset:   0:d89716e88087
++  changeset:   1:263e7765e4b7
+   tag:         tip
++  user:        user name 2
++  date:        Thu Jan 01 00:00:00 1970 +0000
++  summary:     bar
++ =20
++  changeset:   0:d89716e88087
+   user:        Long User Name
+   date:        Thu Jan 01 00:00:00 1970 +0000
+   summary:     foo
+@@ -48,11 +56,72 @@
+   scanning source...
+   sorting...
+   converting...
+-  0 foo
++  1 foo
++  0 bar
+   $ hg -Rnew log
+-  changeset:   0:d89716e88087
++  changeset:   1:263e7765e4b7
+   tag:         tip
++  user:        user name 2
++  date:        Thu Jan 01 00:00:00 1970 +0000
++  summary:     bar
++ =20
++  changeset:   0:d89716e88087
+   user:        Long User Name
+   date:        Thu Jan 01 00:00:00 1970 +0000
+   summary:     foo
+  =20
++  $ rm -rf new
++
++Use authormapsuffix together with authormap
++
++  $ cat > authormap.txt <<EOF
++  > user name =3D username
++  > user name 2 =3D username2
++  > EOF
++  $ hg convert --authormap authormap.txt --authormapsuffix '@test.org' or=
ig new
++  initializing destination new repository
++  scanning source...
++  sorting...
++  converting...
++  1 foo
++  0 bar
++  writing author map file $TESTTMP/new/.hg/authormap
++  $ cat new/.hg/authormap
++  user name 2=3Dusername2@test.org
++  user name=3Dusername@test.org
++  $ hg -Rnew log
++  changeset:   1:aeeaab422b32
++  tag:         tip
++  user:        username2@test.org
++  date:        Thu Jan 01 00:00:00 1970 +0000
++  summary:     bar
++ =20
++  changeset:   0:51317d63da9e
++  user:        username@test.org
++  date:        Thu Jan 01 00:00:00 1970 +0000
++  summary:     foo
++ =20
++  $ rm -rf new
++
++Use authormapsuffix stand alone
++
++  $ hg convert --authormapsuffix '@test.org' orig new
++  initializing destination new repository
++  scanning source...
++  sorting...
++  converting...
++  1 foo
++  0 bar
++  $ hg -Rnew log
++  changeset:   1:94e0dcfe3b0d
++  tag:         tip
++  user:        user name 2@test.org
++  date:        Thu Jan 01 00:00:00 1970 +0000
++  summary:     bar
++ =20
++  changeset:   0:e2ff155c86b8
++  user:        user name@test.org
++  date:        Thu Jan 01 00:00:00 1970 +0000
++  summary:     foo
++ =20
++

Property changes on: files/extra-patch-authormapsuffix
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property

--FyU5fTJCTr/6Eq8v--

--S3Smgu5mAIHx+YOO
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJTpzrFAAoJELls3eqvi17QpFkQAKKmBW/sPQ1bqsisvgSRQRM7
bAV7+8Fp4Eiu4lSJz4AuwFGZTsljnXwTRejLUr6xrtWao+TYm+DTeoBBpG7ue8G+
ySumaLBWnmKuSrATq2wMFtLkWMr2MJ3jTnbQ16cfnSlH7Z8rrO4tJszjeMDtjSL3
ZpPburG5nXuAAEc6+GQc57egDxQveHakEgQ03Ezm+gIvEQOyEM1hjgzNF+WQ3Wip
BnWBH0JO60Pv93+dsV55fuRkfULu2uBY/MI9HQTmnmqWEqhFyL+0NqskV9feQGeA
r3xOxv42epOTozhm8OvzY5D4s2knLLUVHKcp4+gswlpryr/Lhodqsa089W+xeVfo
FVtHBn1zl6EVC6SucnOMUD4rwwE07aHG5YN60/drQfW55tyyFi/Bn4J4hxN8V9BS
CtO5kE3xxwU8zLh8TVwU1kgQe1Ts/YCyFt45nkwq+cfJ++yrp1yjn0gbmvOriS+h
hLlfVdnQAyYo/6pOKZ3zmA/zGM0Y9Mo48YpZoHVVjpB/o+nOyTMTmGd89zcfBnuc
DxeBtX+aWPd4nliBlyuVZrnn03czqbx8GBLc7gjuAhKEL0TMLMu34uL46GUe+Wph
XEOrGWZ0bIit+7dVYhaajFm7WLX/V6dAk31CDh9G9EVj2GQXIT1OgsXfLJaC9aVm
L197n3hJ16VjoHPgw5nA
=rzjZ
-----END PGP SIGNATURE-----

--S3Smgu5mAIHx+YOO--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140622202125.GD1218>