changeset 822:c29eaba651d7

pull: support git.mindate
author Siddharth Agarwal <sid0@fb.com>
date Wed, 29 Oct 2014 19:37:10 -0700
parents 53e7e8f34dcd
children f16eaf601496
files hggit/git_handler.py tests/test-pull.t
diffstat 2 files changed, 49 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py	Wed Oct 29 19:36:33 2014 -0700
+++ b/hggit/git_handler.py	Wed Oct 29 19:37:10 2014 -0700
@@ -233,7 +233,7 @@
         oldheads = self.repo.changelog.heads()
         imported = 0
         if refs:
-            filteredrefs = self.filter_refs(refs, heads)
+            filteredrefs = self.filter_min_date(self.filter_refs(refs, heads))
             imported = self.import_git_objects(remote_name, filteredrefs)
             self.import_tags(refs)
             self.update_hg_bookmarks(refs)
--- a/tests/test-pull.t	Wed Oct 29 19:36:33 2014 -0700
+++ b/tests/test-pull.t	Wed Oct 29 19:37:10 2014 -0700
@@ -256,3 +256,51 @@
      date:        Mon Jan 01 00:00:10 2007 +0000
      summary:     add alpha
   
+
+add old and new commits to the git repo -- make sure we're using the commit date
+and not the author date
+  $ cat >> $HGRCPATH <<EOF
+  > [git]
+  > mindate = 2014-01-02 00:00:00 +0000
+  > EOF
+  $ cd gitrepo
+  $ git checkout -q master
+  $ echo oldcommit > oldcommit
+  $ git add oldcommit
+  $ GIT_AUTHOR_DATE="2014-03-01 00:00:00 +0000" \
+  > GIT_COMMITTER_DATE="2009-01-01 00:00:00 +0000" \
+  > git commit -m oldcommit > /dev/null || echo "git commit error"
+  $ cd ..
+  $ hg -R hgrepo pull
+  pulling from $TESTTMP/gitrepo
+  no changes found
+  $ hg -R hgrepo log -r master
+  changeset:   4:892d20308ddf
+  bookmark:    master
+  parent:      3:56cabe48c4b0
+  parent:      1:7bcd915dc873
+  user:        test <test@example.org>
+  date:        Mon Jan 01 00:00:13 2007 +0000
+  summary:     Merge branch 'beta'
+  
+
+  $ cd gitrepo
+  $ echo newcommit > newcommit
+  $ git add newcommit
+  $ GIT_AUTHOR_DATE="2014-01-01 00:00:00 +0000" \
+  > GIT_COMMITTER_DATE="2014-01-02 00:00:00 +0000" \
+  > git commit -m newcommit > /dev/null || echo "git commit error"
+  $ cd ..
+  $ hg -R hgrepo pull
+  pulling from $TESTTMP/gitrepo
+  importing git objects into hg
+  (run 'hg heads .' to see heads, 'hg merge' to merge)
+  $ hg -R hgrepo log -r master
+  changeset:   8:c7d0cf1a7601
+  bookmark:    master
+  tag:         default/master
+  tag:         tip
+  user:        test <test@example.org>
+  date:        Wed Jan 01 00:00:00 2014 +0000
+  summary:     newcommit
+