-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FindCommitByChangesetId should look in a specific Tfs branch - enhacements #9
base: find_commit_in_specific_branch
Are you sure you want to change the base?
FindCommitByChangesetId should look in a specific Tfs branch - enhacements #9
Conversation
hazzik
commented
Jun 19, 2015
- Resolve TODO on Checkout command
- Correctly cache changesets
Correctly cache changesets
private bool cacheIsFull = false; | ||
|
||
public string FindCommitHashByChangesetId(long changesetId, string tfsPath) | ||
{ | ||
var commit = FindCommitByChangesetId(changesetId, tfsPath); | ||
var commit = FindCommitsByChangesetId(changesetId).FirstOrDefault(c => c.Message.Contains(tfsPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like a lot this solution which consist in travelling along a lot of commit to construct a list and then filter this list with the tfs path :( Because that's not very good in terms of performance...
I'm pretty shure that we can write a private method that take an optional path and :
- if the path is not empty, return immediatly if the commit with the good id and path is found
- if the path is empty, continue to look for this specific changeset id through all the commits
This method could be wrapped in 2 public methods one which accept a tfs path and one another without...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that's not very good in terms of performance...
Most of the cases there will be only one commit in the list, so no performance issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the path is not empty, return immediatly if the commit with the good id and path is found
if the path is empty, continue to look for this specific changeset id through all the commits
We can not do this, because then changesetsCache
will be corrupted, eg. some commits will never be found.
b0fa78f
to
a1cb1c2
Compare
@pmiossec I've changed the solutions. Now it has 2 methods: one which accepts As I understad, this is what you have suggested. |