Merge lp:~jamalta/launchpad/contributions-merge into lp:launchpad

Proposed by Jamal Fanaian
Status: Merged
Approved by: Guilherme Salgado
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~jamalta/launchpad/contributions-merge
Merge into: lp:launchpad
Diff against target: 51 lines (+17/-3)
1 file modified
utilities/community-contributions.py (+17/-3)
To merge this branch: bzr merge lp:~jamalta/launchpad/contributions-merge
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) code Approve
Review via email: mp+18716@code.launchpad.net

Commit message

Created name map for community-contributions to merge people using different names/email addresses.

To post a comment you must log in.
Revision history for this message
Jamal Fanaian (jamalta) wrote :

= Summary =

Created a name map in community-contributions.py that will take care of merging users who have contributed using different names and emails.

== Pre-implementation notes ==

Spoke with salgado to make sure this was a good idea and implementation.

== Tests ==

== Demo and Q/A ==

 % utilities/community-contributions.py --dry-run .

== Launchpad lint ==

The lint notices are unrelated to any changes I made.

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  utilities/community-contributions.py

== Pylint notices ==

utilities/community-contributions.py
    49: [C0301] Line too long (79/78)
    175: [C0301] Line too long (79/78)
    49: [W0702] No exception type(s) specified
    47: [W0403] Relative import 'editmoin'

Revision history for this message
Guilherme Salgado (salgado) wrote :

Looks good to me

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utilities/community-contributions.py'
2--- utilities/community-contributions.py 2009-12-07 20:21:44 +0000
3+++ utilities/community-contributions.py 2010-02-05 19:46:18 +0000
4@@ -46,7 +46,7 @@
5 try:
6 from editmoin import editshortcut
7 except:
8- sys.stderr.write("""ERROR: Unable to import from 'editmoin'. How to solve:
9+ sys.stderr.write("""ERROR: Unable to import from 'editmoin'. How to solve:
10 Get editmoin.py from launchpadlib's "contrib/" directory:
11
12 http://bazaar.launchpad.net/~lazr-developers/launchpadlib/trunk/annotate/head%3A/contrib/editmoin.py
13@@ -123,6 +123,14 @@
14 u'kiko@beetle',
15 )
16
17+# Some people have made commits using various names and/or email
18+# addresses, so this map will be used to merge them accordingly.
19+merge_names_map = {
20+ u'Jamal Fanaian <jfanaian@gmail.com>':
21+ u'Jamal Fanaian <jamal.fanaian@gmail.com>',
22+ u'Jamal Fanaian <jamal@jfvm1>':
23+ u'Jamal Fanaian <jamal.fanaian@gmail.com>',
24+ }
25
26 class ContainerRevision():
27 """A wrapper for a top-level LogRevision containing child LogRevisions."""
28@@ -164,8 +172,9 @@
29 #
30 # -and-
31 #
32- # http://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/revision/\
33- # launchpad@pqm.canonical.com-20090821221206-ritpv21q8w61gbpt
34+ # http://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/\
35+ # revision/launchpad@pqm.canonical.com-20090821221206-\
36+ # ritpv21q8w61gbpt
37 #
38 # In our links, even when the link text is a revnum, we still
39 # use a rev-id for the target. This is both so that the URL will
40@@ -247,6 +256,11 @@
41 known = True
42 break
43 if not known:
44+ # Use the merge names map to merge contributions from the same
45+ # person using alternate names and/or emails.
46+ if a in merge_names_map:
47+ a = merge_names_map[a]
48+
49 ### There's a variant of the Singleton pattern that could be
50 ### used for this, whereby instantiating an ExCon object would
51 ### just get back an existing object if such has already been