#3727 Switch from GIT_SORT_TIME to GIT_SORT_NONE to preserver 'git log'-like commit ordering
Merged 5 years ago by pingou. Opened 5 years ago by bkabrda.
bkabrda/pagure git-sort-none  into  master

file modified
+1 -1
@@ -456,7 +456,7 @@ 

              repo_commit = repo_obj[branch.get_object().hex]

  

              for commit in repo_obj.walk(

-                 repo_commit.oid.hex, pygit2.GIT_SORT_TIME

+                 repo_commit.oid.hex, pygit2.GIT_SORT_NONE

              ):

                  if commit.oid.hex == merge_commit:

                      break

file modified
+3 -3
@@ -1751,12 +1751,12 @@ 

          if branch:

              orig_commit = orig_repo[branch.get_object().hex]

              main_walker = orig_repo.walk(

-                 orig_commit.oid.hex, pygit2.GIT_SORT_TIME

+                 orig_commit.oid.hex, pygit2.GIT_SORT_NONE

              )

  

          repo_commit = repo_obj[commitid]

          branch_walker = repo_obj.walk(

-             repo_commit.oid.hex, pygit2.GIT_SORT_TIME

+             repo_commit.oid.hex, pygit2.GIT_SORT_NONE

          )

  

          main_commits = set()
@@ -1818,7 +1818,7 @@ 

              branch = repo_obj.lookup_branch(branch_from)

              repo_commit = branch.get_object()

  

-         for commit in repo_obj.walk(repo_commit.oid.hex, pygit2.GIT_SORT_TIME):

+         for commit in repo_obj.walk(repo_commit.oid.hex, pygit2.GIT_SORT_NONE):

              diff_commits.append(commit)

  

          _log.debug("Diff commits: %s", diff_commits)

file modified
+2 -2
@@ -914,7 +914,7 @@ 

      number_of_commits = 0

      authors_email = set()

      for commit in repo_obj.walk(

-         repo_obj.head.get_object().oid.hex, pygit2.GIT_SORT_TIME

+         repo_obj.head.get_object().oid.hex, pygit2.GIT_SORT_NONE

      ):

          # For each commit record how many times each combination of name and

          # e-mail appears in the git history.
@@ -971,7 +971,7 @@ 

  

      dates = collections.defaultdict(int)

      for commit in repo_obj.walk(

-         repo_obj.head.get_object().oid.hex, pygit2.GIT_SORT_TIME

+         repo_obj.head.get_object().oid.hex, pygit2.GIT_SORT_NONE

      ):

          delta = (

              datetime.datetime.utcnow() - arrow.get(commit.commit_time).naive

file modified
+2 -2
@@ -265,7 +265,7 @@ 

      if request.status != "Open":

          commitid = request.commit_stop

          try:

-             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_TIME):

+             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_NONE):

                  diff_commits.append(commit)

                  if commit.oid.hex == request.commit_start:

                      break
@@ -417,7 +417,7 @@ 

      if request.status != "Open":

          commitid = request.commit_stop

          try:

-             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_TIME):

+             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_NONE):

                  diff_commits.append(commit)

                  if commit.oid.hex == request.commit_start:

                      break

file modified
+7 -7
@@ -126,7 +126,7 @@ 

      if not repo_obj.is_empty:

          try:

              for commit in repo_obj.walk(

-                 repo_obj.head.target, pygit2.GIT_SORT_TIME

+                 repo_obj.head.target, pygit2.GIT_SORT_NONE

              ):

                  last_commits.append(commit)

                  cnt += 1
@@ -208,7 +208,7 @@ 

          head = None

      cnt = 0

      last_commits = []

-     for commit in repo_obj.walk(branch.get_object().hex, pygit2.GIT_SORT_TIME):

+     for commit in repo_obj.walk(branch.get_object().hex, pygit2.GIT_SORT_NONE):

          last_commits.append(commit)

          cnt += 1

          if cnt == 3:
@@ -240,13 +240,13 @@ 

                  commit.oid.hex

                  for commit in orig_repo.walk(

                      compare_branch.get_object().hex,

-                     pygit2.GIT_SORT_TIME)

+                     pygit2.GIT_SORT_NONE)

              ]

  

          repo_commit = repo_obj[branch.get_object().hex]

  

          for commit in repo_obj.walk(

-                 repo_commit.oid.hex, pygit2.GIT_SORT_TIME):

+                 repo_commit.oid.hex, pygit2.GIT_SORT_NONE):

              if commit.oid.hex in commit_list:

                  break

              diff_commits.append(commit.oid.hex)
@@ -352,7 +352,7 @@ 

      n_commits = 0

      last_commits = []

      if commit:

-         for commit in repo_obj.walk(commit.hex, pygit2.GIT_SORT_TIME):

+         for commit in repo_obj.walk(commit.hex, pygit2.GIT_SORT_NONE):

  

              # Filters the commits for a user

              if author_obj:
@@ -455,13 +455,13 @@ 

  

      # Get commits list

      diff_commits = []

-     order = pygit2.GIT_SORT_TIME

+     order = pygit2.GIT_SORT_NONE

      first_commit = commit1

      last_commit = commit2

  

      commits = [

          commit.oid.hex[: len(first_commit)]

-         for commit in repo_obj.walk(last_commit, pygit2.GIT_SORT_TIME)

+         for commit in repo_obj.walk(last_commit, pygit2.GIT_SORT_NONE)

      ]

  

      if first_commit not in commits:

@@ -644,7 +644,7 @@ 

          commits = [

              commit

              for commit in self.repo_obj.walk(

-                 self.repo_obj.head.target, pygit2.GIT_SORT_TIME)

+                 self.repo_obj.head.target, pygit2.GIT_SORT_NONE)

          ]

          # 2 commits: creation - new comment

          self.assertEqual(len(commits), 2)
@@ -662,7 +662,7 @@ 

          commits = [

              commit.oid.hex

              for commit in self.repo_obj.walk(

-                 self.repo_obj.head.target, pygit2.GIT_SORT_TIME)

+                 self.repo_obj.head.target, pygit2.GIT_SORT_NONE)

          ]

  

          output = pagure.lib.tasks_services.load_json_commits_to_db(