Rev 76: Set author property to preserve committer and original author of the commit. in file:///data/jelmer/bzr-rebase/trunk/

Jelmer Vernooij jelmer at samba.org
Fri Jan 11 23:29:37 GMT 2008


At file:///data/jelmer/bzr-rebase/trunk/

------------------------------------------------------------
revno: 76
revision-id:jelmer at samba.org-20080111232936-oo8s2ccvrgmbz1q4
parent: jelmer at samba.org-20080103191418-h8ildvrv1bt0ezv4
parent: lalinsky at gmail.com-20080111222812-5eex6zgyx32t1iue
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2008-01-12 00:29:36 +0100
message:
  Set author property to preserve committer and original author of the commit.
modified:
  NEWS                           news-20070721005510-kbjm9yxqoeczq9fl-1
  rebase.py                      rebase.py-20070626221123-ellanmf93nw8z9r1-1
  test_rebase.py                 test_rebase.py-20070626221123-ellanmf93nw8z9r1-2
    ------------------------------------------------------------
    revno: 67.1.3
    revision-id:lalinsky at gmail.com-20080111222812-5eex6zgyx32t1iue
    parent: jelmer at samba.org-20071127151447-zt2earxxxuwx502e
    committer: Lukáš Lalinský <lalinsky at gmail.com>
    branch nick: rebase
    timestamp: Fri 2008-01-11 23:28:12 +0100
    message:
      Copy author or committer name from the old revision to the author property in the new revision
    modified:
      rebase.py                      rebase.py-20070626221123-ellanmf93nw8z9r1-1
      test_rebase.py                 test_rebase.py-20070626221123-ellanmf93nw8z9r1-2
=== modified file 'NEWS'
--- a/NEWS	2007-12-09 04:19:20 +0000
+++ b/NEWS	2008-01-11 23:29:36 +0000
@@ -1,5 +1,10 @@
 0.4		UNRELEASED
 
+ ENHANCEMENTS
+
+  * Set author property to preserve committer and original author of the commit.
+    (Lukáš Lalinský)
+
 0.3		2007-12-06
 
  ENHANCEMENTS

=== modified file 'rebase.py'
--- a/rebase.py	2007-12-21 19:21:54 +0000
+++ b/rebase.py	2008-01-11 23:29:36 +0000
@@ -378,8 +378,13 @@
     assert oldrev.revision_id != newrevid
     revprops = dict(oldrev.properties)
     revprops[REVPROP_REBASE_OF] = oldrev.revision_id
+    committer = wt.branch.get_config().username()
+    author = oldrev.get_apparent_author()
+    if author == committer or 'author' in revprops:
+        author = None
     wt.commit(message=oldrev.message, timestamp=oldrev.timestamp, 
-              timezone=oldrev.timezone, revprops=revprops, rev_id=newrevid)
+              timezone=oldrev.timezone, revprops=revprops, rev_id=newrevid,
+              committer=committer, author=author)
     write_active_rebase_revid(wt, None)
 
 

=== modified file 'test_rebase.py'
--- a/test_rebase.py	2007-12-21 18:20:06 +0000
+++ b/test_rebase.py	2008-01-11 23:29:36 +0000
@@ -518,7 +518,7 @@
         wt.add(["afile"], ids=["originalid"])
         wt.commit("bla", rev_id="oldparent")
         file("old/afile", "w").write("bloe")
-        wt.commit("bla", rev_id="oldcommit")
+        wt.commit("bla", rev_id="oldcommit", committer="c")
         wt = wt.bzrdir.sprout("new").open_workingtree()
         self.build_tree(['new/bfile'])
         wt.add(["bfile"], ids=["newid"])
@@ -533,6 +533,7 @@
         self.assertEquals("newcommit", newrev.revision_id)
         self.assertEquals(oldrev.timestamp, newrev.timestamp)
         self.assertEquals(oldrev.timezone, newrev.timezone)
+        self.assertEquals("c", newrev.get_apparent_author())
 
     def test_multiple(self):
         wt = self.make_branch_and_tree("old")




More information about the bazaar-commits mailing list